How to create a subclass of a nested class ?

I have code like this:
public class A {
public class Inner { }
how can I create a subclass of A.Inner ?
I got an error when I declare:
public class subInner extends A.Inner {}

I have code like this:
public class A {
public class Inner { }
how can I create a subclass of A.Inner ?
I got an error when I declare:
public class subInner extends A.Inner {}the subInner class must have the following constructor
subInner( A a )
    a.super();
}whenever u want to create an object of SubInner, use the followng
new SubInner(new A() )
Reason is :. When u want to create an object of "subclass", its superclass should also be called; the superclass is Inner. The class Inner needs an instance of outer class (A) to bind to.
regards

Similar Messages

  • How to create a exe file of a .class file

    how to create a .exe file for windows .class file of java
    please answer this so that i can complete the project to be submited to collage

    There is a program called JET. Is enables you to create .exe files of .class files.
    This is the URL:
    http://www.excelsior-usa.com/jet.html
    Succes
    --=tReShR=--

  • How to create an object within the same class???

    hi im just a newbie
    i v been always creating an object from the main class..
    but how to create an object inside the same class??
    i got main and students class
    the main got an array
    Students[] stu = new Students[]
    and i got
    stu[i] = new Students(id,name);
    i++;
    but i wanna do these things inside the Students class..
    i tried ..but i got errors.....
    how to do this
    .

    javaexpert, :)
    I really have no idea what you are trying to do since you say you've always been creating an object from the main class, yet you always want to create an object inside the same class.
    I'll assume that you have an object in the main class that you are trying to access from the Students class.
    If you are trying to access objects that are contained within the main class FROM the Students class, then know that there are two ways of doing so, one being static, and the other dynamic (look up definitions if unclear):
    1.) make the objects in the main class both static and public and access the the objects using a convention similiar to: Main.object; It's important to note that Main is the name of your main class, and object is a static object. There are better ways of doing this by using gettter/setter methods, but I'll omit that tutorial.
    2.) Create a new instance of the main class and access the objects using a similiar fashion: Main myInstance = new Main(); myInstance.myObject;
    You should really use getter and setter methods but I'll omit the code. In terms of which approach is better, step one is by far.
    I don't mean to be condecending, but you should really brush up on your programming skills before posting to this forum. This is a fundamenetal concept that you will encounter time and time again.

  • How to create an object of our own class by using Class.forName()??

    how to create an object of our own class by using Class.forName()??
    plzz anser my qustion soon..

    Class.forName does not create an object. It returns a reference to the Class object that describes the metadata for the class in question--what methods and fields it has, etc.
    To create an object--regardless of whether it's your class or some other class--you could call newInstance on the Class object returned from Class.forName, BUT only if that class has a no-arg constructor that you want to call.
    Class<MyClass> clazz = Class.forName("com.mycompany.MyClass");
    MyClass mine = clazz.newInstance();If you want to use a constructor that takes parameters, you'll have to use java.lang.reflect.Constructor.
    Google for java reflection tutorial for more details.
    BUT reflection is often abused, and often employe when not needed. Why is it that you think you need this?

  • How to get the subclass from a super class( or interface)

    hi,
    I want to get subclass from a super class (or a interface), how to do that? the subclass of a interface means the class implementing the interface.
    for example;
    List ls;
    I want to get the subclass of ls, i.e., LinkedList, Stack, Vector......
    AbstractList al;
    the subclass of al, i.e., ArrayList, Vector.......
    thanks
    Aiwu

    List ls = new ArrayList();Since ls has been declared as a List we can only use List methods
    with it. This is a good thing because we might later want to change
    it to some other sort of List.
    I want to get subclass from a super class (or a interface), how to do
    that?The instance of the subclass declared above did not really come
    from the super class. A class "knows nothing" about its
    subclasses: many sub classes would not even exist at the time
    the class was written.

  • How to create an instance of a protected class outside the enclosing packag

    Hi all,
    I have a piece of code like this:
    package test;
    public class A {
    protected class B { }
    How to create an instance of B outside the package test ? Could you please give me an example ?
    Thanks
    Ha Chau

    Thank WirajR for your reply, but in your solution,
    you have to create an instance of B inside class A
    and pass it outside. I would like to know whetherwe
    can create an instance of class B outside thepackage
    test. That means I want the instance creation
    expression of B appears outside the package test.Can
    we do that?
    If you want to use a class this way then it shouldn't
    be marked protected. I can't see why you don't
    just declare it public if that's what it is.
    Wouldn't be much point to haveing a protected
    modifier if it had no effect, would there?I think there is use for it if you use an interface to filter out the parts you want to give public access to, and keep the part you want to keep protected, protected

  • How to create dynamically a method of a class??

    I would like to create dynamically a method of a class. Is this possible?
    By means of a report I would like to choose a class, to which the defined method should be added and after that I would like to define the name of the method and its parameters. The result should be, that the method is added to the selected class.
    How to do this?
    Regards
    Christian

    Christian,
    looks like an interesting development project. Though I share the doubts Rich has.
    Anyway, what you could possibly do is, start a runtime analysis for SE24, open an existing class, create a new method including desired interface parameters.
    Then analyze it and see what functions/methods are used.
    But It might be more complex than expected.
    Regards,
    Clemens

  • How to create web service for a Java class in SAP NetWeaver Studio

    hi all,
    i am using SAP Netweaver Developer Studio.have created a normal java project and i want to create web service for one of the classes in this project. i used the  Web Service Creation Wizard to create a web service for this class. but it says there's no methods available for VI. all my methods in this class are public, what should i do?

    Hi,
    I guess there are other ways. But this is an easy way, if you find the right wizards.
    Besides this it is good practise to define interface methods so that session bean implement these interface methods, and thus seperate the interface from the implementation.
    In this approach you will need 3 projects:
    An enterprise application project (will contain EJB Module)
    An EJB Module project (will contain session bean)
    A Java project (contains code that implements the session bean methods)
    In my previous post I suggested to use a J2EE web mudule project. This was a mistake, it should be EJB module.
    But it should be possible to do it in another way. It is up to you.
    Good luck, Roelof

  • How to create a ActiveX Object with custom classes

    Hi
    I am trying to create a Active X object for some of the work I have done in Java to be used with VB, but I cannot get the Active X object to generate and it always come up with the following error:
    Exception occurred during event dispatching:
    java.lang.NoClassDefFoundError: uk/co/agena/minerva/model/Model
    at java.lang.Class.getMethods0(Native Method)
    at java.lang.Class.getDeclaredMethods(Unknown Source)
    at java.beans.Introspector$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.beans.Introspector.getPublicDeclaredMethods(Unknown Source)
    at java.beans.Introspector.getTargetEventInfo(Unknown Source)
    at java.beans.Introspector.getBeanInfo(Unknown Source)
    at java.beans.Introspector.getBeanInfo(Unknown Source)
    at sun.beanbox.JarInfo.<init>(Unknown Source)
    at sun.beanbox.JarLoader.createJarInfo(Unknown Source)
    at sun.beanbox.JarLoader.loadJar(Unknown Source)
    at sun.beans.ole.Packager.loadBean(Unknown Source)
    at sun.beans.ole.Packager.generate(Unknown Source)
    at sun.beans.ole.Packager.actionPerformed(Unknown Source)
    at java.awt.Button.processActionEvent(Unknown Source)
    at java.awt.Button.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForComponent(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForComponent(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
    This appears to be beacuse the class uk/co/agena/minerva/model/Model is a custom class which is based on the software I am using. Does anyone know how I can get around this issue. I have tried incluijng those class files for the custom classes within the jar file, but I continue to get the same issue?
    Any help would be gratefully received.
    Thanks
    Angie

    This error is no longer coming up, it is now saying that it has an unsupported class version error. I believe this may be because the class file and library files have been complied under different versions, is there a method to check this?

  • How to create a new object of HttpServletRequest class manually?

    Dear all,
    I don't know how silly my question is, however I have no way except asking.
    I know that when I send a request from the client to the server, server authomatically creates an object of
    HttpServletRequest and assigns all the request information to that object, so that you can extract these information by the available methods in the HttpServletRequest class like getHeader, getMethod and so on. What I need to do in my project is doing all above process manually. My question is how I can do it?
    In other words, I have the header and body part of a http request and I want to create a HttpServletRequest
    object and assign the header and body data to the object so that I'll be able to extract those data by using the getHeader, getMethod and other methods available in the HttpServletRequest class.
    Please Help me, I really need your help?
    Your help is appreciated.
    Thanks.

    Hi shadgar ,
    as rightly mentioned by Sudha and GrayMan, you can provide the implementation for the HttpServletRequest interface in your own way for the requirement, but it leads to a new Servlet Container development as you need to handle many things than the HttpServletRequest.
    I think the current interface and the Servlet Container will be able to handle if your request is over HTTP protocol and it don't deviate from the prtocol's request/response model.
    Check out the javax.servlet.http.HttpServletRequestWrapper class, which is the implementation of the javax.servlet.http.HttpServletRequest and javax.servlet.ServletRequest interfaces.
    Hope it will give some idea about the actual problem and rethink about the solution proposed.
    Thanks,
    Sanath Kumar

  • Help! How to create Jar file for a packaged class?

    Hi!
    I am new in jar complexities. I made a swing frame that just prompts a JOptionPane when executed. I accomplished the same using jar without packaging my class SwingTest.
    But when i package it, it doesn't run. Can any one tell me how to make jar file of packaged classes and include images in the jar files too!
    Really Thanx!

    Call the Jar from the commandline to see the exceptions thrown.
    java -jar <jarFileName> <className>

  • How to create a decimal object in a class?

    Post Author: farnaz
    CA Forum: WebIntelligence Reporting
    Hi,
    I have two fileds in database, one field is sign (-,+) and another is value( for example 73.92), I want to create an object with these two fields (-73.92).In Object Properties, in select window , I use " to_number(( SIGN )||to_char( VALUE))" but it rounds the value (-74) although when I use this select in database it returns (-73.92) . what I should do to have this value as an object in universe?
    Best Regards
    Farnaz

    Post Author: jsanzone
    CA Forum: WebIntelligence Reporting
    Farnaz,
    I don't have a real-life example that I can use to "play" with this, so here is a suggestion.  In your formula "to_char(VALUE)" portion, first format VALUE with the number format capability:
    FormatNumber(VALUE;"##.##")
    So maybe: to_char(FormatNumber(VALUE;"##.##"))

  • How to create a af:selectManyCheckBox from Pojo Class DataControls?

    Hi All,
    I haven't worked on POJO based datacontrols till now. Can anyone give me a pointer where it is explained to create a <af:selectManyCheckBox> component using these datacontrols?

    Hi User404/Suipto,
    Thanks for that pointer. I created the select many check-box and did various things on it using Binding contexts in managed beans. But i have a question: -
    For now i am creating my List Values based on a POJO that has only 2 data members. It means from the class of which i have created data controls i am returning my L.O.V as a List Of object of a different class that has only 2 data members, but i am getting absurd behavior when i add some more data members. In that case my pageDef file contains Items in AttrNames tag only to be the that i have chosen to be displayed. So when i add odr fields also in AttRNames than my select many check Box displays combination of all the Items in AttrNames.
    But i dont want this. So i added odr fields in ListDisplayAttrNames. But this is not working as ListDisplayAttrNames api is not in use. So i cannot figure out when i have my LOV objects' data members number more than 2 then in what way should the binding be performed?
    Any HELP*
    Edited by: Avi on Nov 27, 2012 9:40 AM

  • How to create a .bat file to run *.class files?

    Hello.
    I have compiled java *.class files.
    I would like to make a shortcut on my desktop to run my Java programs.
    How to write a shortcut (.bat file or something else) to run Java programs?
    Thanks

    1) Make it into an executable jar file (internet search for "java executable jar" will give you lots of help)
    2) Write a batch file. If you do not know how to do this, a Java forum is not the place to find out. Do an internet search or find a windows support site.

  • How to create an exe file for single class

    Hi all,
    l have one some program with only one class and want to create one exe file for
    easily execute for the user.
    I've use exe4j and another tool to do but all failure, the error message always shown me that main class not found.
    Any idea??
    Thanks a lot!

    I suspect your class has somewhat invalid thing.
    Have you verified:
    - The class you wish to be executed contains public static void main(String args[])- The package declaration on your executable-wannabe class is valid
    - In case you need to import another class, make sure the import statement(s) is valid
    No matter what kinda program you use to create .exe from java class, the above things must be valid. AFAIK.
    Regards,
    Farid Herman

Maybe you are looking for

  • Comparar colunas de duas listas do Sharepoint 2013

    Pessoal, minha dúvida é a seguinte: Tenho duas listas no Sharepoint, a Lista A que é uma lista com um termo de aceite, onde você deve preencher com seu CPF e clicar no botão de aceite do termo. A Lista B possui uma base de dados com todos os usuários

  • N80 How do you configure a dial up account?

    On my SE p800 I could create a dial up account as the equivalent of an Access Point on the N80. Is it possible to add a normal dial up internet account as an access point? or do you have to use WLAN or a pre defined access point such as 'O2 MobileWeb

  • Cannot printout the invoice bulk files.

    Hello. We have using PDF on R3 through Adobe Document Service on JAVA stack. The PDF is invoice file. We can printout the file. but cannot printout multiple invoice files at one time. To do, We have input output device. Then developer changed the sou

  • I now have two accounts with same number!

    On May Tenth my account was charged, but the card on file had been cancelled due to security reasons on my end! I put in my new card, but at that time it wouldn't let me renew! I was told The only way to renew was to get another account under my sign

  • Spam Filtering Key words or Whitelisting

    I would appreciate any help. We are running a mail server on an Intel xserve with 10.4.11 server. Spam trainer and RBL's are set up to block spam. Is there a way to block key words and Whitelist domains? I would like to customize some of the paramete