Anup Kumar Mandal
new operator for creating the object of inner class
0 Answer(s)      2 years and 8 months ago
Posted in : Java Interview Questions

Hi ,

The folliowing is my code :

class Outer {

 class Inner{
        void show()
           {
             System.out.println("Hello ");
           }

    }

} class Test { public statis void main(String args[]) {

       Outer objOuter = new Outer();
       Outer.Inner  objInner = objOuter.new Inner();

     }
}

My question is in the line : Outer.Inner objInner = objOuter.new Inner();

Here how objOuter.new works ?

Regards , Anup Kumar Mandal

Advertisement
View Answers









Related Tutorials/Questions & Answers:
new operator for creating the object of inner class
new operator for creating the object of inner class  Hi , The folliowing is my code : class Outer { class Inner{ void show...[]) { Outer objOuter = new Outer(); Outer.Inner objInner = objOuter.new Inner
Inner class
{ i=new Inner(); } class Inner...("Inner"); } } } class...Inner class   //This code doesn't Works// import
Advertisements
inner class
inner class  what is mean by inner class   Inner class is a non-static class which is defined inside another class
Inner class
Inner class  how can i call outer class A `s method to print Outer... class TestInners { public static void main(String[] args) { new...(); class A { void m() { System.out.println("inner"); } } } class A { void m
Inner class
Inner class  when we use inner classed in java
about inner class
about inner class  class Outer { class Inner{ public void m1(){ System.out.println("Inner class Method"); } } public void m2(){ Inner i = new Inner(); i.m1(); } public static void main(String ar[]){ Outer o = new Outer(); o.m2
Java inner class
Java inner class  What are inner class and anonymous class
Inner Class - Java Beginners
Inner Class  Hi, I have the following question. class Outer{ class Inner{ } public static void main(String[] args) { Outer.Inner inner = new Outer().new Inner(); } } If I compile the above code
I retrieve a String or other object type without creating a new object each time.
I retrieve a String or other object type without creating a new object each time.  How can I retrieve a String or other object type without creating a new object each time
java inner class - Java Beginners
with the enclosing class itself, whereas inner classes are associated with an object...java inner class  What is the difference between the nested class and inner class? Explain with suitable example.  Hi Friend
Inner class in java
for defining a class and the syntax required to instantiate an object. Inner...Inner class in java In this example we will describe inner classes in java. Inner class declared inside a class. The inner class also call Nested classes
creating new file with File class - JSP-Interview Questions
creating new file with File class   I have a file uploading concept in my project. For that, while creating a new file is it necessary to give... of FileOutputStream class. If we give the path as from the file uploading location will it work
inner class - Java Interview Questions
inner classes are associated with an object of the enclosing class. The given...Java Inner Class  How many classes we can create in an inner class?  How many classes we can create in an inner class ANS :- Within Main
Inner class - Java Interview Questions
Inner class  whether inner class can implement any interface(Runnable... Inner inner; private class Inner extends Thread { Inner(String name...() + ": " + countDown; } } public InnerClass1(String name) { inner = new Inner
Java inner class and static nested class
Java inner class and static nested class  Java inner class and static nested class
Use of Local Inner class
element. The main method that instantiate a Inner Class object and this is used... Use of Local Inner class     ... class. Such a class is defined as Nested Class or Local Inner class. The Nested
Inner class in java
, a non-static nested class is actually associated to an object rather than to the class in which it is nested. For more details click on the following link Inner class in Java
Class and object
Class and object  what is exact meaning for the statement, A a1=new B();   Hi, Here is two classes A and B. A is super class...(); } } With the help of following line: A a = new B(); You are creating
What is inner class in Java? - Java Beginners
What is inner class in Java?  Hi, Explain me inner classes in Java. What is the use of inner classes? Give examples of inner classes in Java...://www.roseindia.net/java/master-java/inner.shtml Uses: Non-static inner class
class and Object
class and Object  how many classes,References and objects in this following statement.... A a=new B();   Hi, In the statement: A a=new B(); There are 2 classes, Class A and Class B. References : 1 (Object of B
object of object class
object of object class  what do u mean by "object of object class
create a new object in JavaScript
create a new object in JavaScript  How do you create a new object in JavaScript
create a new object in JavaScript
create a new object in JavaScript  How do you create a new object in JavaScript
PHP Instanceof Operator
is used to check an object that whether this is an object of specified class or not. instanceof can also be used to determine whether an object of a class... that an object is not an instanceof a class, the  logical not is used
What is the difference between a static and a non-static inner class?
What is the difference between a static and a non-static inner class?   Hi, What is the difference between a static and a non-static inner class? Thanks
Type Comparison Operator
;    Java provides a run-time operator instanceof to compare a class and an instance of that class. This operator " instanceof" compares an object to a specified class type. The instanceof operator is defined
Anonymous Inner Classes - Anonymous Inner Classes tutorial
inner class(here it is new ActionListener()) without creating a separate class... of an object without creating subclass of a class and also performing additional tasks... the inner class, there are two types of supplementary  inner classes
Inner classes
there is Inner class defined . A) Outer ob = new Outer(); Ob.display(); // calling instance method of Outer class Outer.Inner ob1= ob.new Inner(); // creating object of non static class Then if the above code is correct then why donĂ¢â
PHP Class Object
the object $a, we  call the function disp with -> operator. Any class can...PHP Class Object: In object oriented programming a class can be an abstract... apple, orange are the object of this class. Object is the instantiate
Object class in java
Object class in java  want an example and with an explaination about equals() method in object class? Is equals() is similar
java object class methods
java object class methods  What are the methods in Object class?  There are lots of methods in object class. the list of some methods are as- clone equals wait finalize getClass hashCode notify notifyAll