new operator for creating the object of inner class

Ads
 

new operator for creating the object of inner class

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

View Answers

Ads









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
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
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
ModuleNotFoundError: No module named 'inner-class'
ModuleNotFoundError: No module named 'inner-class'  Hi, My Python... 'inner-class' How to remove the ModuleNotFoundError: No module named 'inner-class' error? Thanks   Hi, In your python environment
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
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
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
Creating Data Access Object (DAO) Design Pattern
Creating Data Access Object (DAO) Design Pattern Data Access Object... can use in anywhere in you application by making an object of DAO class... to separating the object persistence and data access logic. All the basic data access
Does memory for Class or Object?
Does memory for Class or Object?   Does memory for class(methods & instance variables)allocated without it's object creation?If no,then The main() itself has associated with a class for which there is no instance creation,how
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Ă¢â
The new keyword
an instance of a class or an array by using the new operator. Creating a simple java object (non array object) by using the new operator. String sName = new String(); Creating an array object by using the new operator. Array
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
The new keyword in java
initializes the new object this is nothing but initialization. The new operator instantiate a class by allocating memory for a new object and returning a reference to that memory. The new operator also invoke object constructor. The new
In Java how to get size of class and object?
In Java how to get size of class and object?  In Java how to get size of class and object
In Java how to get size of class and object?
In Java how to get size of class and object?  In Java how to get size of class and object
Can you create an object of an abstract class?
Can you create an object of an abstract class?   Hi, Can you create an object of an abstract class? Thanks
Object Class Methods in Java
We are going to discus about Object Class Methods in Java...(), wait(), etc Java object class methods are:- finalize() clone() equals... finalize() method. Object's class finalize method is declared
Limit the Class Object Creation
Limit the Class Object Creation In this section you will learn about how a class object creation can be a restricted to a fix number of times... to restrict the object creation of a class. This is a simple code in Java where I have
How to access sub class member using super class object
How to access sub class member using super class object  class A{ } class B extends A{ int b=1; } class Test{ public static void main(String args[]) { what to do here to access sub class variable b using super class object
what is the working of JVM when An object is created of a class?
what is the working of JVM when An object is created of a class?  what is the working of JVM when An object is created of a class?   When the JVM creates the instance of your class object,the object instance is stored
Creating JDBC Statement object
; } Creating JDBC Statement Object JDBC Statement is an interface of java.sql....;passWord"); // Creating connection object Statement stmt=connection.createStatement(); // Creating statement After the use of connection object you should close
c++ new, delete, string class
c++ new, delete, string class  Write one program containing all... contained in string1: Exercise 1 Good morning Create a new string named string2... Exercise 5 69 Create a new string named string6 containing the contents from
MYSQL - mysql copy table to another table example by creating new table
MYSQL - mysql copy table to another table example by creating new table ... a new table with all the data from this table. How to create a new table and select all the data into this new table? Thanks   Hi, You can use
how to get session object in simple java class??
how to get session object in simple java class??  i am fallowing... work. 1) GroupDetails.jsp 2) GroupPojo.java (simple pojo class which have setters and getters) 3) GroupServlet.java (a servlet class for control) 4

Ads