Code:
interface TestA {String toString(); } public class Test{ public static void main(String[] args) { System.out.println(new TestA()) { public String toString() {return "test"; } }); } }
What is the result ?
1. Test
2.Null
3. An exception thrown at runtime.
4. Compilation fails because of an error in line 1.
I Think it should be 3 But can someone explain whats the right answer and why ? :)
Comment