• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

is it righ?

 
Naresh Saw
Ranch Hand
Posts: 66
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 Saw
Ranch Hand
Posts: 66
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sry guys i got the answer.

sry
 
Steve Morrow
Ranch Hand
Posts: 657
Clojure Spring VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 213
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic