1.
what about an inner class within a static method. what fields it can access?
what about an static inner class. What fields it can access?
it can acess static instance variables of outer class and final local variables of the method in which it is declared
2. For anonymous clasess?
In pg 197 of Simon Roberts:
A form of anonymous class can also be declared in this way:
Xxxx AnXxxx = new Xxxxx{ /* class body */ } -- It is said that we can assign the reference to the constructed object into a variable.
Where can such form of anonymous class be declared? Please give me an example.
Runnable a=new Runnable(){public void run(){//code}};
Thread t=new Thread(a);
t.start();