This week's book giveaway is in the General Computing forum.
We're giving away four copies of Learning Regular Expressions and have Ben Forta on-line!
See this thread for details.
Win a copy of Learning Regular Expressions this week in the General Computing forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Modifiers for anonymous inner classes and static nested classes  RSS feed

 
Ranch Hand
Posts: 54
  • 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?
 
Greenhorn
Posts: 26
  • 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
 
Sheriff
Posts: 11343
Java Mac Safari
  • 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...
 
Ranch Hand
Posts: 138
  • 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
  • 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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!