I do not know the meaning of this question. If this is an interview question, I can say that everything is in order. But in real time, this is not the right approach to implement inheritance. So, to answer the question, here you are making an anonymous inner class .
Here you create a class and , implementing inheritance , write
System.out.println(new TestA() { public String toString() { return "test"; } });
and of course the result will be test
Abhijit Chakra Mar 21 '14 at 12:19 2014-03-21 12:19
source share