What are the advantages of Java inner classes?

Solution:

There are two types of advantages of Java inner classes.

  • Nested classes represent a special type of relationship that is it can access all the members (data members and methods) of the outer class including private.
  • Nested classes are used to develop a more readable and maintainable code because it logically groups classes and interfaces in one place only.
  • Code Optimization: It requires less code to write.
0 answers