Hi,
In K&B page 646 it is mentioned that "the same rules apply to
method-local inner classes as to local variable declarations. You can't, for example,mark a method-local inner class public, private, protected, static, transient,and the like. The only modifiers you can apply to a method-local inner class are abstract and final, but as always, never both at the same time.
But when I tried this piece of code with different modifiers it worked:
public class MyClass1 {
public static void main(
String argv[]){ }
/*Modifier at XX */ class MyInner {}
}
What modifiers would be legal at XX in the above code?
1) public
2) private
3) static
4) friend
Class MyInner is in main() method so it should only allow final or abstract modifier but it is allowing pub;ic and private modifier also.
Can anyone explain this.Is this a error in K&B