Frage im Vorstellungsgespräch bei Lab49

Can an anonymous class in Java only extend another class, only implement an interface, do both or do none?

Antwort im Vorstellungsgespräch

Anonym

27. März 2013

One or the other. For example, new Foo() {...}, Foo can either be a class or an interface. One should be able to extend both by extending a class that implements an interface.