Which two code snippets, added independently at line ***, can make the Buzzword class compile?

Given the two Java classes:

public class Word {

private Word(int length) {}

protected Word(String w) {}

}

public class Buzzword extends Word {

public Buzzword() {

// Line ***, add code here

}

public Buzzword(String s) {

super(s);

}

}

Which two code snippets, added independently at line ***, can make the Buzzword class compile?

Given the two Java classes:

public class Word {

private Word(int length) {}

protected Word(String w) {}

}

public class Buzzword extends Word {

public Buzzword() {

// Line ***, add code here

}

public Buzzword(String s) {

super(s);

}

}

Which two code snippets, added independently at line ***, can make the Buzzword class compile?

A.
this ();

B.
this (100);

C.
this (“Buzzword”);

D.
super ();

E.
super (100);

F.
super (“Buzzword”);



Leave a Reply 10

Your email address will not be published. Required fields are marked *


Boris

Boris

this() constructor does not exists. It has to be this(“Buzzword”);

Jetendra

Jetendra

Answer C and F

ses

ses

class Word {
private Word(int length) {
}
protected Word(String w) {
}
}

public class Buzzword extends Word {

public Buzzword() {
// Line ***, add code here
// super(“b”);
this(“b”);
}
public Buzzword(String s) {
super(s);
}
public static void main(String[] args) {
new Buzzword();
}
}

Ray

Ray

C F is correct.

manish purohit

manish purohit

C & F is correct option.

gelete

gelete

C, F

// A. False. Recursive constructor invocation Buzzword()
// this ();

// B. False. The constructor Buzzword(int) is undefined
// this (100);

// C. True
// this (“Buzzword”);

// D. False. The constructor Word() is undefined
// super ();

// E. False. The constructor Word(int) is not visible
// super (100);

// F. True
// super (“Buzzword”);