Declaring a method when creating an object
7
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?
java object methods
share | improve this question
edited 1 hour ago
ernest_k
19.7k 4 19 42
asked 2 hours ago
Sekonoishi Kamiki
36 1
...