• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Q from javacertificate

 
Ranch Hand
Posts: 443
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This statement is marked true in their mock exam:


An instance of a top level nested class can be created without an instance of its enclosing class.


I think what they are referring to here is the static nested class. But the problem is that the term top level nested class does not exists in the JLS. There is a term top level class but it refers to any class that is not nested.
Any comments?
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Exactly Alton! The term "top level nested class" refers to a static inner class, and the book on Java Certification by Khalid Moghul also uses the same to explain the concept of different types of nested/inner classes.
If I may quote from the book


A top level nested class or interface is similar to a top level or interface, but it is defined as a static member of an enclosing top level class or interface (Section 7.2)


The term is used because the behaviour of static inner classes is hardly any different from the normal top level classes.
 
Alton Hernandez
Ranch Hand
Posts: 443
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Anupreet,
Thank you for your reply.
I guess the main issue is that the term "top level nested class" does not exists in the JLS. They should not be using terminologies from one particular book because different authors may use different terminologies.
[ August 19, 2003: Message edited by: Alton Hernandez ]
 
Anupreet Arora
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, U r right Fren!
In the JLS, second line of the chapter 8 is

"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".


So if "a top level class is a class that is not a nested class" then term "top level nested class" is a kind of oxymoron!!
Maybe it is used more to relate to the behaviour of a specific type of nested classes, than as a technically correct reference. So clearly, such usage in exams, mock or real, should be checked.
Regards,
Anupreet
 
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wonder if the term top-level nested was used in the first edition of the JLS.
 
Are we home yet? Wait, did we forget the tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic