Explain anonymous Class in Java -
when program run display function gets called. not able understand how?
class { class b { void display() { system.out.println("display in b....."); } } } class twenty extends a.b { twenty(a temp) { temp.super(); } public static void main(string args[]) { obj=new a(); twenty abc=new twenty(obj); abc.display(); } }
explain program
this simple class twenty
extending class b
.
since there method display
in b
class, twenty
inherits method if method declared in it. why able call display
method on object of class twenty
abc
.
Comments
Post a Comment