Styrow.dev
Question 128 of 247
Java Topic: General medium

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

Question

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

Answer

No. An anonymous class can either extend a class or implement a single interface. If the anonymous class is extending a class then it becomes the implementer of all the interfaces implemented by its superclass automatically.