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
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "anonymous inner class" Watch "anonymous inner class" New topic
Author

anonymous inner class

gangqiang zhang
Greenhorn

Joined: Oct 28, 2005
Posts: 5
Hello,everybody

Given the following,



Which two create an anonymous inner class from within the class Bang ?

  • Bang b = new Bing("Foo"){};
  • Bing b = new Bing(343){};
  • Bing b = new Bing(){"Foo";};
  • Bing b = new Bang(){};
  • Bing b = new Bing.Bang("Foo"){};



  • The reference answer is C & D.Why the answer C is correct answer? Could anybody give me a explanation.
    Seb Mathe
    Ranch Hand

    Joined: Sep 28, 2005
    Posts: 225
    Imagine that the statement Super(bangs); is replaced with super(bangs) (code won't compile otherwise), C is incorrect because the statement "Foo"; is invalid.


    Regards,<br />Seb<br /> <br />SCJP 1.4
    gangqiang zhang
    Greenhorn

    Joined: Oct 28, 2005
    Posts: 5
    thanks, seb

    The question is on the CD of K&B's book.
    Kevin Lam
    Ranch Hand

    Joined: Oct 27, 2005
    Posts: 68
    what makes the answer>annonymous class ? I thought to make it annonymous you haveto extends or implements there and then the answer looks like a normal innerdass only
    gangqiang zhang
    Greenhorn

    Joined: Oct 28, 2005
    Posts: 5
    thx,
    gangqiang zhang
    Greenhorn

    Joined: Oct 28, 2005
    Posts: 5


    Hence,I can get another anonymouse inner class like the preceding code.It is a subclass of Bing class.

    Regards

    zhang
    Leoo yu
    Greenhorn

    Joined: Nov 01, 2005
    Posts: 13

    That's lapsus calami .


    [Deleted]
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: anonymous inner class