File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Modifiers for anonymous inner classes and static nested classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Modifiers for anonymous inner classes and static nested classes" Watch "Modifiers for anonymous inner classes and static nested classes" New topic
Author

Modifiers for anonymous inner classes and static nested classes

janki tangeda
Ranch Hand

Joined: Jun 07, 2005
Posts: 54
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

Joined: Oct 07, 2006
Posts: 26
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

Joined: Aug 31, 2004
Posts: 11343

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...


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Praveen Babu
Ranch Hand

Joined: Jul 30, 2006
Posts: 138
Follow the link,

http://home.tiscali.nl/illuminate/scjp/section6_3_1.html
catherine powell
Greenhorn

Joined: Oct 07, 2006
Posts: 26
Thank you Marc and Praveen for clarifying this topic for me. I've bookmarked this page...it helped me a lot. Thanks again...Catherine
 
Consider Paul's rocket mass heater.
 
subject: Modifiers for anonymous inner classes and static nested classes
 
Similar Threads
private and protected class?
Inner Classes
are real exam quesions so complicated????
Confused on private modifier for classes