0% found this document useful (0 votes)
22 views

Nested Class

The document discusses nested classes in Java, which allow a class to be defined within another class. It explains that nested classes are divided into non-static and static categories, with non-static classes called inner classes. If an outer class contains an inner class, the outer class inherits all methods of the inner class by default.

Uploaded by

2020 - CE - 19
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

Nested Class

The document discusses nested classes in Java, which allow a class to be defined within another class. It explains that nested classes are divided into non-static and static categories, with non-static classes called inner classes. If an outer class contains an inner class, the outer class inherits all methods of the inner class by default.

Uploaded by

2020 - CE - 19
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

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.

You might also like