How do inner classes work in Java?

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 the instance, we can’t have any static variables in them.

Sizin İçin Seçtik  What is the difference between inner class and subclass?

Leave a Reply

Your email address will not be published. Required fields are marked *