New course! Every coder should learn Generative AI!
Try a free lesson+ 2
How can I use the inner class? I didn't get it right
More explain
2 Answers
+ 2
In Java, just like methods, variables of a class too can have another class as its member. Writing a class within another is allowed in Java. The class written within is called theĀ nested class, and the class that holds the inner class is called theĀ outer class.
+ 1
class Outer_Demo {
class Nested_Demo { }
}