What snippet can be a part of a declaration of an inner class:
: (select all)
: A. private MyInner {
Deepa,
You are right to say A and B are wrong. However C is also right. An inner class declared with the Static modifier is refered to as a top-lebel inner class and is perfectly legal. However you can not have a top - level inner class declared inside a method. Thus you can not having something like
void someMethod(){
static class inner {//illegal
}
}
and the reason is that all variables declared inside method blocks ( or any other code block indeed) exist only while that block is existing. On the contrary, variables declared static static exist whenever there class is loaded. So you can not have a temporary-permanent variable.
This should help on question1 I guess.
Actually the above discussion should be enough to tell you that on question 2, e is WRONG. This is on the basis that as long as a class is within a method ( Regardless of whether the method is static or not), it can not be declared static.
A and B are definately wrong because inside interfaces you can only have method declarations,constant varaible declarations and subInterfaces, not classes.
I stand to be corrected.
Herbert
