• 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

private and protected enums

 
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I declared an instance enum with private/protected access modifier, The compiler did not flag any error. Whereas in the chapter one its mentioned that enums can only have public and default access. Can any one please clear my confusion?
Thanks
Deepak
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chapter one? Of what book? Possibly the book means that enums declared at top level can only be default or public?
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I declared an instance enum with private/protected access modifier, The compiler did not flag any error. Whereas in the chapter one its mentioned that enums can only have public and default access. Can any one please clear my confusion?



If the enum declared out outside class then it should have only public or default access. Whereas, if the enum declared inside class then it may have private and protected too
reply
    Bookmark Topic Watch Topic
  • New Topic