Wednesday, April 18, 2007

Can an anonymous class implement an interface and extend a class at the same time?

No,an anonymous class can either implement an interface or extend a class at a particular time but not both at the same time.

2 comments :

Anonymous said...

yes i can be done at the same time for example we do it applet class..we extend an applet class in our custom class and implements an ActionListner interface in same class...!!!

Shubham tyagi on February 4, 2012 at 5:10 AM said...

This can be done only when u have a inner class with name....
not with anonymous class
if u do it shows the error....

 

Disclaimer
Interview Questions On Java,Java EE Copyright © 2017. Reads: best tracker