Blog
What is Inner class in Java? – tccicomputercoaching.com
- March 18, 2020
- Posted by: Riddhi Dhandha
- Category: Java course at TCCI
Inner class means one class inside another class or we can say that one class is member of another class.
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/