About Question com.enthuware.ets.scjp.v6.2.654 :

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
shkolnik
Posts: 8
Joined: Tue Oct 25, 2011 10:46 am
Contact:

About Question com.enthuware.ets.scjp.v6.2.654 :

Post by shkolnik »

Option "Objects of top level nested classes can be created without creating instances of their Outer classes." seems to be ambigous. Please consider changing to "Objects of top level static nested classes can be created without creating instances of their Outer classes." Without this qualification I don't think the statement is correct as it is not true for all objects of top level nested classes.

admin
Site Admin
Posts: 10062
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question com.enthuware.ets.scjp.v6.2.654 :

Post by admin »

Hello,
You are right. This and a few other questions were based on an outdated terminology. Initially, when Java came out with inner classes, static nested classes were also considered top level classes. To quote, Sun's "Inner Class" specification:
In addition, the programmer can define one top-level class as a static member of another top-level class. Unlike an inner class, a top-level class cannot directly use the instance variables of any other class. The ability to nest classes in this way allows any top-level class to provide a package-like organization for a logically related group of secondary top-level classes.

Inner classes and nested top-level classes are implemented by the compiler, and do not require any changes to the Java Virtual Machine. They do not break source or binary compatibility with existing Java programs.
Later on, they changed the terminology as follows:
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. An inner class is a nested class that is not explicitly or implicitly declared static. A class defined inside an interface is implicitly static.
Sorry for the confusion. This has now been updated.

HTH,
Paul.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 70 guests