aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Anonymous inner class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Anonymous inner class" Watch "Anonymous inner class" New topic
Author

Anonymous inner class

srinivas sridaragaddi
Ranch Hand

Joined: Jul 24, 2007
Posts: 225


1)i know that an anonymous inner class can extend one subclass
or implement one interface but it cannot do both my questions is
here it is implementing only one interface but even then
the compiler error is generated at line1


SCJP 5.0<br /> <br />"Skills are started with learning and mastered with improvement. Nothing is hereditary except death" BUDDHA...
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14269
    
  21

The syntax of this line is just wrong:

You can't add "implements B" at that place. You cannot make an anonymous class implement an interface in that way.

You can create an anonymous class that implements an interface like this:


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Anonymous inner class