• 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
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

how non-static enum can be accessed without object?

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?

 
Sheriff
Posts: 27451
88
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 814
Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Enums are implicitly static in class.
 
Mahesh Murugaiyan
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
So I left, I came home, and I ate some pie. And then I read this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic