• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Modifiers for anonymous inner classes and static nested classes

 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it possible to declare any modifier for anonymous inner class?
If not, does it have any implicit modifiers?

For a static nested class what other modifiers can be specified?
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Everyone,

I have the same questions that were never answered in this old post (except I understand that anonymous classes are implicitly final (�15.9.5))...

1. Does anyone know if there is any way to specify a modifier (for example strictfp) on an anonymous class?

2. Am I correct in saying that the only modifiers that can be applied to static nested classes are: final, strictfp, coderanch, protected and private?

Thanks very much in advance...Catherine
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by catherine powell:
...1. Does anyone know if there is any way to specify a modifier (for example strictfp) on an anonymous class? ...


I don't believe that's possible. Anonymous classes allow you to define only the class body (understanding that the reference will be automatically upcast, so you don't want to introduce anything that's not already declared in the supertype).

Originally posted by catherine powell:
...2. Am I correct in saying that the only modifiers that can be applied to static nested classes are: final, strictfp, coderanch, protected and private? ...


Note that static nested classes can be abstract...
 
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Follow the link,

http://home.tiscali.nl/illuminate/scjp/section6_3_1.html
 
catherine powell
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Marc and Praveen for clarifying this topic for me. I've bookmarked this page...it helped me a lot. Thanks again...Catherine
 
reply
    Bookmark Topic Watch Topic
  • New Topic