chapter 8: Inner classes
Question 8:
public class Foo{
Foo(){Sytstem.out.print("foo");}
class Bar{
Bar(){Sytstem.out.print("hi");}
}
public static void main(
String[] args){
Foo f = new Foo();
f.makeBar();
void makeBar(){
(new Bar()){}).go();
}
}
}
-----------------
Just trying to understand the line:
(new Bar()){}).go();
This is considered to be an anonymous class but at the same time is this is a mathod-local inner class as well?
[couldn't find any such examples in the book either under anonymous class or method-local class]
Can anyone give a better explanation?