File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes anonymous classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "anonymous classes" Watch "anonymous classes" New topic

anonymous classes

shashank hiwarkar1

Joined: Feb 11, 2001
Posts: 25

Anonymous Inner classes cannot implement an interface and extend a non-final class at the same time.

can anyone explain me why?
(From Abhilash Exam)

Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
Because the syntax doesn't support it.
If you make an anonymous class you say
new InterfaceName(){ . . .};
new ClassName(){. . .};
in order to do BOTH you have to stuff 2 names in the new statement.

"JavaRanch, where the deer and the Certified play" - David O'Meara
I agree. Here's the link:
subject: anonymous classes
jQuery in Action, 3rd edition