Static Nested Class in java

Java Programming Language Class, Object and Methods in java (Article) Class, Object and Methods in java (Program)

951

Program:

 class OuterClass{
  double d = 16.5;
  static String s="Static";

  static class InnerClass{
    int x;
    public void show()
    {
		x=6;
       System.out.println("value of x is:"+x);
       System.out.println("value of s is:"+s);
     }
  }
}

class StaticNested{
  public static void main(String[] args)
  {
    OuterClass.InnerClass obj1=new OuterClass.InnerClass();
    obj1.show();

  }

}

Output:

value of x is:6
value of s is:Static
Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.