This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Local class is a inner class? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Local class is a inner class?" Watch "Local class is a inner class?" New topic
Author

Local class is a inner class?

Badri Sarma
Ranch Hand

Joined: Apr 01, 2003
Posts: 72
Hi
i know that local class is a inner class, what access modifiers are applied to local class.
Can we provide public,private,protected or static
Badri


Thanks<br />Badri
Srik Buddha
Greenhorn

Joined: May 03, 2003
Posts: 3
From what I understand, I think the local classes are those classes that are declared inside a method. Access modifiers are not allowed, though static is allowed.
Srik
Rory French
Ranch Hand

Joined: Apr 03, 2003
Posts: 97
A Local inner class can be declared iether abstract or final, and it may be declared strictfp. It may NOT be declared static, and may NOT be declared with any access modifiers (i.e. private, protected, public).
[ May 03, 2003: Message edited by: Rory French ]
Srik Buddha
Greenhorn

Joined: May 03, 2003
Posts: 3
U r right, Rory.
Local class cannot be declared static. My fault.
Badri Sarma
Ranch Hand

Joined: Apr 01, 2003
Posts: 72
Thanks a lot
A local class is a inner class which is declared inside the method.
It cannot have any access modifiers like public, private, protected, and static.
where in it can have abstract, final and strictfp
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Local class is a inner class?