Such class is known as nested class.
Syntax:
class OuterClass {
// ...
class NestedClass {
// ...
}
}
How to access inner class?
To access the inner class, create an object of the outer class, and then create an object of the inner class.
There are basically four types of inner classes in java.
1) Nested Inner class
2) Method Local inner classes
3) Anonymous inner classes
4) Static nested classes
The nested class makes code more readable and maintainable because there are group's of related classes.
To learn more in detail about Java Nested Class.
Join TCCI in Bopal and Satellite in Ahmedabad.
Call us @ 9825618292
Visit us @ httt://tccicomputercoaching.com/
No comments:
Post a Comment