Nested Class
Nested Class
The Java programming language allows you to define a class within another class. Such a class is called a nested
class and is illustrated here: class Outer Class {... class Nested Class {... } } Terminology: Nested classes are divided
into two categories: non-static and static. Non-static nested classes are called inner classes. The Java programming
language allows you to define a class within another class. Such a class is called a nested class and is illustrated
here: class Outer Class {... class Nested Class {... } } Terminology: Nested classes are divided into two categories:
non-static and static. Non-static nested classes are called inner classes.
if A is a outer class and B is a inner class A have inherited all B methods by default and no other class can inherit this
B class.
And this is the best use of encapsalution.