in Core Java

Java Inner Classes – An Introduction

Java Inner Classes – An Introduction

Inner classes are those which are wrapped inside a class. They are also called as nested classes.
There are static inner classes, we can also call them as Static nested classes.
Inner classes are regular members of a class. They are just like methods and variables declared in a class. Remember Inner classes are also regular members of the outer class.
Because Inner classes are members of outer class, we can apply all the access modifiers to inner class. That means we can declare the inner class as public, protected, default or private.
If you notice the difference here you can see that we can apply all the access modifiers to Inner classes whereas for normal class, only public and default access modifiers are applicable.
Then, With respect to non-access modifiers, we can apply static, final, abstract and strictFp.

 

 

Srinivas Reddy

Srinivas Reddy

An IT - Specialist with loads of experience in Java, J2ee platforms and loves to share his experience on technology with You...

More Posts - Website

Follow Me:
TwitterFacebook

Related Posts

Srinivas Reddy
Written By:

An IT - Specialist with loads of experience in Java, J2ee platforms and loves to share his experience on technology with You...