Which two class definitions compile?

Given: interface Doable {
public void doSomething (String s);
}
Which two class definitions compile?
A. public abstract class Task implements Doable {
public void doSomethingElse(String s) { }
}
B. public abstract class Work implements Doable {
public abstract void doSomething(String s) { }
public void doYourThing(Boolean b) { }
}
C. public class Job implements Doable {
public void doSomething(Integer i) { }
}
D. public class Action implements Doable {
public void doSomething(Integer i) { }
public String doThis(Integer j) { }
}
E. public class Do implements Doable {
public void doSomething(Integer i) { }
public void doSomething(String s) { }
public void doThat (String s) { }
}

Download Printable PDF. VALID exam to help you PASS.

8 thoughts on “Which two class definitions compile?

    1. Sorry , A is right too … although the Task class does not implement the doSomething method of the Doable interface, the Task class is an abstract class, thus allowing unimplemented methods.

Leave a Reply

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


The reCAPTCHA verification period has expired. Please reload the page.