• Dear Guest, Please do NOT forget to join our JAVA JOBS (ONLY) FACEBOOK GROUP to be aware of latest JAVA openings, and you may also post any JAVA related queries/jobs.

What are the types of Inner Classes or Nested Classes ?

There are four flavors of Inner Classes.

1. Static Member Inner Classes
2. Non-Static Inner Classes
3. Local Inner Classes
4. Anonymous Inner Classes
plz state some examples of above classes?
A class with another class is called Inner classes.Without existing outer class object there is no chance to exist inner class object.

In java 4 types of inner classes are there
1.Method local inner classes
2.Static Inner classes
3.Non-static inner classes
4.Anonymous inner classes

Non static inner classes means if a class declared as static then static methods are allowed without static we can not write.
With in the method also we can declare a class that type of classes are called Method local inner classes.The scope of the Method local inner classes is with in the block only.out side the method we can not access.
Anonymous means without using the name For Single usage you can declare that type of classes you can declare as Anonymous.