What code should be inserted?

Given:
public class Bark {
// Insert code here – Line 5
public abstract void bark(); // Line 6
} // Line 7
// Line 8
// Insert code here – Line 9
public void bark() {
System.out.println(“woof”);
}
}
What code should be inserted?

Given:
public class Bark {
// Insert code here – Line 5
public abstract void bark(); // Line 6
} // Line 7
// Line 8
// Insert code here – Line 9
public void bark() {
System.out.println(“woof”);
}
}
What code should be inserted?

A.
5.class Dog {
9. public class Poodle extends Dog {

B.
5. abstract Dog {
9. public class poodle extends Dog {

C.
5. abstract class Dog {
9. public class Poodle extends Dog {

D.
5. abstract Dog {
9. public class Poodle implements Dog {

E.
5. abstract Dog {
9. public class Poodle implements Dog {

F.
5. abstract class Dog {
9. public class Poodle implements Dog {

Explanation:
Dog should be an abstract class. The correct syntax for this is: abstract class Dog {
Poodle should extend Dog (not implement).



Leave a Reply 2

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


Tim

Tim

The code won’t compile – a “}” missed at the end of the program.

Kurt

Kurt

The correct answer is C