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

Modifiers for anonymous inner classes and static nested classes

 
janki tangeda
Ranch Hand
Posts: 54
  • 0
  • Mark post as helpful
  • send pies
  • 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?
 
catherine powell
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • 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, public, protected and private?

Thanks very much in advance...Catherine
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • 0
  • Mark post as helpful
  • send pies
  • 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, public, protected and private? ...

Note that static nested classes can be abstract...
 
Praveen Babu
Ranch Hand
Posts: 138
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Follow the link,

http://home.tiscali.nl/illuminate/scjp/section6_3_1.html
 
catherine powell
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic