This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Journey To Enterprise Agility and have Daryl Kulak & Hong Li on-line!
See this thread for details.
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Top-level classes  RSS feed

 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A static inner class is called "A top-level Inner Class"
 
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!