Number Of Page View:100,000+/Months
LOGIN |New User


Creating an Inner Class Object from Outside the Outer Class
Instance Code
If we want to create an instance of the inner class, we must have an instance of the outer class. we want instantiate the inner class from a static method of the outer class or from any
other code in any other class. Inner class instances are always handed an implicit
reference to the outer class.The code to make an instance from anywhere outside nonstatic code of the outer class is simple, but we must memorize this for the exam!
public static void main (String[] args) {
MyOuter mo = new MyOuter();
MyOuter.MyInner inner = MyInner();