aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Ambiguous answer to anonymous classes 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 "Ambiguous answer to anonymous classes" Watch "Ambiguous answer to anonymous classes" New topic
Author

Ambiguous answer to anonymous classes

jason adam
Chicken Farmer ()
Ranch Hand

Joined: May 08, 2001
Posts: 1932
Here's the question from JQ+
Question ID :1003595458180
Consider the following code:

The answer given is class created inside the main method is final, stating that all anonymous inner classes are implicitly final, understand that well enough. However, they also give an answer that an object of class B cannot be created in main simply by doing new B();
Only one answer is chooseable, both are correct. Am I missing something here?
Jason
Cameron Park
Ranch Hand

Joined: Apr 06, 2001
Posts: 371
I am not sure whether B can inherit from A and at the same time has lesser accessibility(default) than A(public).
Paul Anilprem
Enthuware Software Support
Ranch Hand

Joined: Sep 23, 2000
Posts: 3314
    
    7
Jason, you are right. The other option should also be marked correct as given in the explanation.
------------------
SCJP2, SCWCD Resources, Free Question A Day, Mock Exam Results and More!
www.jdiscuss.com
Get Certified, Guaranteed!
JQPlus - For SCJP2
JWebPlus - For SCWCD
JDevPlus - For SCJD


Enthuware - Best Mock Exams and Questions for Oracle/Sun Java Certifications
Quality Guaranteed - Pass or Full Refund!
jason adam
Chicken Farmer ()
Ranch Hand

Joined: May 08, 2001
Posts: 1932
Heya Paul, thanks for the clarification, thought I was overlooking some detail and was just racking my brain trying to figure it out! Plus, I wanted to see if other people got the same answer, since I've mistakenly thought what was supposed to be the answer before
Jason
 
wood burning stoves
 
subject: Ambiguous answer to anonymous classes