enfrptes

sendassignment@tutorspoint.com

Static Inner Classes Homework Help

What are Static inner classes in Java?

If we define an inner class as static then it is known as a static inner class.

Properties of static inner classes

a) We can define any access specifier before a static inner class.

b) Static inner classes can have static members as well as nonstatic members.

c) Static members of a class are directly available to the static and non-static members of that class but non-static members of a class are not directly available to the static members of that class.

d) In a static inner class, even if we define a non-static function, it is still static because it is in a static class. I.e. it is in the static domain.

e) From the static inner class, we cannot access any non-static members of the outer class directly. In order to do so, we need to create an object of outer class explicitly.