Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Kb question pg 660

 
Dinesh Tahiliani
Ranch Hand
Posts: 486
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
class BOO
{

BOO(){}
BOO(String s){}
}

class Bar extends BOO
{
Bar(){}
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
 
Minu Jain
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic