Java

Nested Class In Java1 min read

Java Code:

Java allows you to declare a class inside a class that is known as nested class.




Nested class are used to logically group classes and interfaces in one place so that it can be more readable and maintainable code.

Advantage of java nested classes

1.Nested classes represent a special type of relationship that is it can access all the members (data members and methods) of outer class including private.

2.Nested classes are used to develop more readable and maintainable code because it logically group classes and interfaces in one place only.

3.Code Optimization: It requires less code to write.

Leave a Comment