File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes is it righ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "is it righ?" Watch "is it righ?" New topic
Author

is it righ?

Naresh Saw
Ranch Hand

Joined: Sep 03, 2005
Posts: 66
class Base{
public Base(int i){}
}

public class MyOver extends Base{
public static void main(String arg[]){
MyOver m = new MyOver(10);
}

MyOver(int i){
super(i);
}

MyOver(String s, int i){
this(i);
//Here
}

}

which of the following can be inserted at //Here without compile time error
1)MyOver m = new MyOver();
2)super();
3)this("Hello",10);
4)Base b = new Base(10);

According to me Answer should be 1 & 4.

Please correct me if i m wrong.


naresh<br />SCJP 1.4(86%), SCWCD 1.4(78%)
Naresh Saw
Ranch Hand

Joined: Sep 03, 2005
Posts: 66
sry guys i got the answer.

sry
Steve Morrow
Ranch Hand

Joined: May 22, 2003
Posts: 657

Every mock exam I've seen provides the correct answer along with an explanation. Which exam does this question come from?

I believe your answer is incorrect, though, and a quick test should verify this...
[ September 15, 2005: Message edited by: Steve Morrow ]
Patrick Williams
Ranch Hand

Joined: Apr 03, 2005
Posts: 213
1 would not be correct because there is no default constructor defined, but there are two defined that take parameters (so that means that the default is not created by the compiler). The only correct answer is 4.


Patrick<br /> <br />SCJP/SCWCD/SCBCD/SCDJWS/SCEA<br /> <br />Currently working on:<br />SCJP 6
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: is it righ?
 
Similar Threads
Competition between “this”and “super” in constructor
Construcors
marcus Green question
MarcusMock No - 2 - Question 53.
Mock of Marcus Green