How can I use the inner class? I didn't get it right | Sololearn: Learn to code for FREE!
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

9th Dec 2016, 9:14 AM
mohammed alhedai
mohammed alhedai - avatar
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.
9th Dec 2016, 2:46 PM
Aditya
Aditya - avatar
+ 1
class Outer_Demo { class Nested_Demo { } }
9th Dec 2016, 2:47 PM
Aditya
Aditya - avatar