| Author |
modifiers to inner class
|
Venkat Ramsimha
Ranch Hand
Joined: Dec 28, 2004
Posts: 127
|
|
the only modifiers you can apply to a method-local inner class are abstract and final. (But of course, never both of those at the same time as with any other class or method.) WHY we shud not HAVE OTHER ACCESS MODIFIERS FOR INNER CLASSES hi all, can anybody provide the explanation thanks, venkat
|
 |
Joe Sondow
Ranch Hand
Joined: Apr 10, 2005
Posts: 195
|
|
The modifiers that you CAN use are abstract, final, and strictfp. The other modifiers that exist but cannot be used on method-local inner class (also known as "local classes") include the following: transient, volatile, native, static, public, private, protected For a method-local inner class... You can't use transient or volatile because they only apply to instance variables. You can't use native because that only applies to methods. You can't use static, public, private, or protected because those have no meaning for something declared inside a method. (Ask yourself what it would mean to use any of those on a local class.) All of these 4 keywords are meant only to modify a member of a class, but a local class cannot be a member of a class.
|
SCJA 1.0 (98%), SCJP 1.4 (98%)
|
 |
 |
|
|
subject: modifiers to inner class
|
|
|