0 votes
in JAVA by
What is a nested class?

1 Answer

0 votes
by

The nested class can be defined as the class which is defined inside another class or interface. We use the nested class to logically group classes and interfaces in one place so that it can be more readable and maintainable. A nested class can access all the data members of the outer class including private data members and methods. The syntax of the nested class is defined below.

class Java_Outer_class{    

 //code    

 class Java_Nested_class{    

  //code    

 }    

}    

      

There are two types of nested classes, static nested class, and non-static nested class. The non-static nested class can also be called as inner-class

Related questions

+1 vote
asked May 12, 2021 in JAVA by rajeshsharma
0 votes
asked Apr 8, 2021 in JAVA by SakshiSharma
...