What is inner classes in java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 13

What is inner classes in java?

14th Feb 2018, 8:15 PM
A͢J
A͢J - avatar
4 Answers
+ 3
A class defined inside another class which may or may not be private.
4th Mar 2019, 10:03 PM
Sonic
Sonic - avatar
+ 1
class OuterClass { class InnerClass { // this class is inside another class } }
14th Feb 2018, 10:05 PM
1of3
1of3 - avatar
15th Feb 2018, 12:14 AM
Diwakar
Diwakar - avatar
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.
13th Jul 2018, 9:30 AM
Preksha
Preksha - avatar