What is the main difference between an internal class and a static internal class? Is it just a difference in design design?
java inner-classes nested-class
Overlapping classes are divided into two categories. One is static. One is static. Static superposition laths are common It's called the static internal class, and the static is called the internal class.
OuterClass.StaticNestedClass
Usually, static internal classes can be accessed by class names. So even if there are no objects in the outside class,
OuterClass.StaticNestedClass nestedObject = new OuterClass.StaticNestedClass();
You can create objects.
In contrast, the inner class needs objects from the outer class surrounding the inner class as shown below to create objects.
OuterClass outerObject = new OuterClass();
OuterClass.InnerClass innerObject = outerObject.new InnerClass();
© 2024 OneMinuteCode. All rights reserved.