JLS page 135 states that "A nested class is any class whose declaration occurs within the body of another class or interface", also on page 140, it says "An inner class is a nested class that is not explicitly or implicitly declared static"
TJPL 2nd ed. page 52 states that "Non-static nested classes are called inner classes"
Nutshell 3rd ed. page 117 states that "there are four other types of classes, loosely known as inner classes", including "Static member classes"
Marcus Green mock exam #2 Q44 states that "An inner class may be defined as static" (correct answer)
which version is "official"? also what should we answer if we encountered questions like this?
Howdy -- In this new 1.4 version of the exam, we tried to modify the language to change the use of "inner class" to "nested class" in all cases, static or not. But I'm not certain we were 100% successful on changing everything. But here's the breakdown of terminology you *might* see, and what it means on the exam: * Nested class -this could be either static or non-static * Inner class - this could *also* mean either static or non-static * Top-level nested class Definitely means STATIC nested/inner class * Non-static inner class or non-static nested class -speaks for itself * Static inner class or static nested class Definitenly means STATIC nested/inner class So.... STATIC inner/nested class could be called any of the following: * Top-level nested class * static inner class * static nested class a NON-static inner/nested class could be called any of the following: * nested class * inner class * method-local inner class * anonymous inner class The only issue you might have is that you *might* see a question similar to the following: Which of these modifiers may be used on with an inner class? static transient synchronized strictfp and so on... In this case, it would be appropriate to choose "static" as a correct answer. Some people have found this disturbing because they assume that the term "inner class" automatically means DEFINITELY NOT STATIC, but we're using the term "inner" in a broader sense -- in the old, original sense of the word. But as I said, I'm pretty sure we got rid of all of those anyway. Just know that you will NEVER be expected to recognize the difference between "inner" and "nested". Yes, you can count on me to make things even more confusing cheers, Kathy
* Top-level nested class Definitely means STATIC nested/inner class Just so people know, the term "top-level nested class" came from to poorly-named "Inner Class Specification" which has since been replaced by the JLS 2nd edition. The JLS2, which has now been out almost three years, no longer uses the term "top-level nested class" - instead it uses "static member class". The term "top-level" now refers only to classes which are not nested. A static member class is not considered top-level, nor is it an inner class. Of course, what you see on the exam may be different; follow Kathy's post for that. I'm just reporting what the spec says, as that's "official" answer. For what it's worth, when I took the 1.4 exam none of these terms appeared anywhere on the questions I saw. They just used code samples to show a class, and let me figure out what kind of class it was, and how it would behave. I wasn't expected to give the name - only to understand how it works. In the distant past (Java 1.1?), it was reported that the exam did contain a question that referred to a "static inner class" (which was never correct terminology, even in the Inner Classes Specification). But this seems to have been removed some time ago.