aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes K&B SCJP 5...Chap2..Que 7 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 "K&B SCJP 5...Chap2..Que 7" Watch "K&B SCJP 5...Chap2..Que 7" New topic
Author

K&B SCJP 5...Chap2..Que 7

raghu dubey
Ranch Hand

Joined: Jul 05, 2007
Posts: 72
Hi

I could not understand the explaination that the book gives for the answer.It a drag and drop question and goes like this:

Code:
class AgedP {
__________ __________ __________ __________ __________
public AgedP(int x) {
__________ __________ __________ __________ __________
}
}
public class Kinder extends AgedP {
__________ __________ __________ _________ ________ __________
Self Test Answers 167
168 Chapter 2: Object Orientation
public Kinder(int x) {
__________ __________ __________ __________ __________ ();
}
}
Fragments: Use the following fragments zero or more times:
AgedP super this
( ) { }
;

======
Answer:
class AgedP {
AgedP() {}
public AgedP(int x) {
}
}
public class Kinder extends AgedP {
public Kinder(int x) {
super();
}
}
As there is no droppable tile for the variable x and the parentheses (in the Kinder constructor),
are already in place and empty, there is no way to construct a call to the superclass constructor
that takes an argument. Therefore, the only remaining possibility is to create a call to the no-argument
superclass constructor. This is done as: super();. The line cannot be left blank, as the
parentheses are already in place. Further, since the superclass constructor called is the no-argument
version, this constructor must be created. It will not be created by the compiler because
there is another constructor already present.


=======================
"As there is no droppable tile for the variable x and the parentheses (in the Kinder constructor),
are already in place and empty, there is no way to construct a call to the superclass constructor
that takes an argument."


what does the above sentence trying too say.

Please help.


Thanks,<br />Raghu.<br /> <br />SCJP 5, SCWCD 1.4, NCFM
dolly shah
Ranch Hand

Joined: Jun 18, 2007
Posts: 383
Description is tryiing to say, "Kinder constructor has ()(non-argumented call). this() cannot goes there because there is no other constructor in Kinder class. So non-argumented super() must goes there.


SCJP-1.5<br />SCWCD-1.4
raghu dubey
Ranch Hand

Joined: Jul 05, 2007
Posts: 72
Now I see whats is happening.

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: K&B SCJP 5...Chap2..Que 7