• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how non-static enum can be accessed without object?

 
Mahesh Murugaiyan
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

This is Question #3 in practice exam 2 in Bates/Sierra's Practice Exam book.
Numinor is a stand alone class with the "Members" enum. How can this enum(which is a non-static member of Numinor) accessed without creating an object for Numinor class?

 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mahesh Murugaiyan wrote:How can this enum(which is a non-static member of Numinor) accessed without creating an object for Numinor class?


But that question is based on the incorrect assertion that the enum is a non-static member of the class in which it's declared. Once you drop that idea, there's no problem at all.
 
Ninad Kulkarni
Ranch Hand
Posts: 802
Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Enums are implicitly static in class.
 
Mahesh Murugaiyan
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ninad. Thanks Paul, yes, thats makes total sense. Other than enum, interface(constants) are there any other entitiy that is implicitly static ? I will add this to my study notes.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic