Inner classes in java

Ashok Veer | May 21, 2020 | |

In java inner class which is defined inside another class is called nested class or non-static inner class. For instantiating the inner class or nested class object we first need to create the outer class object. We can access outer class member’s variables insides of inner class just like normal members variables of class.

We cannot declare static method or static variable inside the non-static inner class. If we try to declare it shows error The field or static variable cannot be declared static in a non-static inner type.  read more


Share this article

0 comments:

Post a Comment

 
Copyright © 2019 techfloaters • All Rights Reserved.
Template Design by Ashok Veer ( veersoft solution)