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 Kb question pg 660 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 "Kb question pg 660" Watch "Kb question pg 660" New topic

Kb question pg 660

Dinesh Tahiliani
Ranch Hand

Joined: Aug 06, 2007
Posts: 486
class BOO

BOO(String s){}

class Bar extends BOO
Bar(String s){ super(s);}
void zoo

insert cde

Options are :
1. BOO f = new Bar(){}
2. BOO f = new BOO() { String s;}
3. Bar f = new BOO(){ String s;}

ANswers are 1 and 2

Can anyone please me this

Thanks<br />Dinesh
Minu Jain
Ranch Hand

Joined: Mar 24, 2008
Posts: 74
Option 1 is correct because Boo is a superclass of Bar.
Option 2 is correct for obvious reasons.
Option 3 is incorrect because Bar is a subclass of Boo.

Hope the explanation is enough!

"Even if you're on the right track, you'll get run over if you just sit there."
It is sorta covered in the JavaRanch Style Guide.
subject: Kb question pg 660