Why first way is correct, but second isn't?
First way:
new Object() {
public void a() {
/*code*/
}
}.a();
Second way:
Object object = new Object() {
public void a() {
/*code*/
}
};
object.a();
And where can I find more information about it?