An advantage of Inner Class

  • Eclipse: Oxygen
  • Java: 1.8

This tutorial depicts the Advantage of Inner Class as we have discussed so far in this series of tutorials. Inner classes are the concept where we want to add more encapsulation to the given code. When we declare a class inside a class then the inside class can access all the private members in addition to the inner class can be hidden from the outside world.

An advantage of inner classes

In Java, there are three advantages of inner classes. They are as follows:

  • Inner classes represent a special type of relationship that allows access to all members (data members and methods) of the outer class, including the private class.
  • Inner classes are used to develop a more readable and maintainable code because they logically group classes and interfaces in one place.
  • Code optimization requires less code to write.

Contributed by: Poonam Tomar


Buy me a coffee!



  • Get video tutorials
  • Project files set
  • Get Certified

Leave a Reply

Notify of
Close Menu