Help Center

Local Navigation

Using static inner classes

When you use an inner class to hide one class inside another, but the inner class does not reference the outer class object, declare the inner class as static. This action prevents the creation of a reference to the outer class.

If you use an inner class for name scoping, make it static.

Code sample

class outer {
static class inner {


Was this information helpful? Send us your comments.