JLS 2 Chapter 8 : A nested class is any class whose declaration occurs within the body of another class or interface. A top level class is a class that is not a nested class. Inner classes specification : http://java.sun.com/products/jdk/1.1/docs/guide/innerclasses/spec/innerclasses.doc1.html In addition, the programmer can define a class as a static member of any top-level class. Classes which are static class members and classes which are package members are both called top-level classes SO, package com.deepak; class Outer { static class IsThisTopLevel { } } Is the class 'IsThisTopLevel' a top level class (as per the Inner class specs) or just a nested class (as per JLS2)
Uvnik Gupta
Ranch Hand
Joined: Jul 24, 2000
Posts: 32
posted
0
A static inner class is called "A top-level Inner Class"
Jim Yingst
Wanderer
Sheriff
Joined: Jan 30, 2000
Posts: 18670
posted
0
The JLS2 has changed the definition of "top-level". Before JLS2, "top-level" could mean regular top-level, or top-level nested (the so-called "static inner" class). But that evidently just confused people, so under JLS2 they've changed top-level to mean only "regular" top-level, never any sort of nested class. Under JLS2 the former top-level nested ("static inner")classes are now called static member classes. Note that static member classes are not, and never have been, true inner classes, so the term "static inner class" is incorrect, though widely used anyway.