This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Error in MasterExam? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Error in MasterExam?" Watch "Error in MasterExam?" New topic

Error in MasterExam?

M. Herder

Joined: Feb 24, 2003
Posts: 5
this is a question in the MasterExam II attached with the K&B book.

Which two create an anonymous inner class from within class Bang?
The reference told me that these are the correct answers:
c) Bing b = new Bing(){"Foo";};
d) Bing b = new Bang(){};
I think d) is OK, but c) should be :
Bing b = new Bing("Foo"){};
Do you agree?
Anupam Sinha
Ranch Hand

Joined: Apr 13, 2003
Posts: 1090
Hi Herder
I do agree. Just "Foo"; is not a legal statement.
I agree. Here's the link:
subject: Error in MasterExam?
It's not a secret anymore!