+ 13
What is inner classes in java?
5 ответов
+ 3
A class defined inside another class which may or may not be private.
+ 1
class OuterClass {
class InnerClass {
// this class is inside another class
}
}
0
Any non-static nested class is known as inner class in java. Java inner class is associated with the object of the class and they can access all the variables and methods of the outer class.
Since inner classes are associated with instance, we can’t have any static variables in them.