Which statement is true?

Options
- An anonymous inner class can access final variables in any
- enclosing scope.
- An anonymous inner class may be declared as protected.
- An anonymous inner class can implement multiple interface.


CORRECT ANSWER : enclosing scope.

Discussion Board
soln

class Outer
{
int ox=100;
void test(){
Inner inner= new Inner();
inner.Display();
}

class Inner{
void Display()
{
S.o.p("Display : ox"+ox);
}
}
}

from above code we can visualise we can acces data member of outer class without creating its object..

Piush 07-2-2014 01:39 PM

Write your comments


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)


Advertisement