class Outer { final int outer=10; void display() { Inner in = new Inner(); in.show(); } class Inner{ Inner() { System.out.println( "this value is displayed when an object is created "+outer); } void show() { System.out.println("This is inner class"); } } } class InnerDemo{ public static void main(String args[]) { Outer out = new Outer(); out.display(); //Outer.Inner object = new Inner(); } }