What is inner classes in java? | SoloLearn: Learn to code for FREE!

+12

What is inner classes in java?

2/14/2018 8:15:24 PM

AJ #L1G3

5 Answers

New Answer

+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 } }

+1

https://www.sololearn.com/learn/Java/2173/

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.

0

🅰🅹 - ɪ'ᴍ ᴄʀɪᴍɪɴᴀʟʟʏ ɢᴏᴏᴅ! You can read all about inner class with examples. Inner classes have some rules also please visit here: https://javagoal.com/nested-classes/