File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how non-static enum can be accessed without object?

 
Mahesh Murugaiyan
Greenhorn
Posts: 21
  • 0
  • 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
Pie
Posts: 20203
26
MySQL Database
  • 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
Hibernate Linux Spring
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Enums are implicitly static in class.
 
Mahesh Murugaiyan
Greenhorn
Posts: 21
  • 0
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic