Leave a Reply 2

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


ARJIT GAUTAM

ARJIT GAUTAM

B and D would be the valid class declarations

renko

renko

Code question:

//This code is not given in the question
public class App {
public static void main(String[] args) {
System.out.println(“Answer: B, D”);
}

}
abstract class X {
public abstract void methodX();
}
public interface Y {
public void methodY();
}
// A:
class Z1 extends X implements Y {
public void methodZ() { }
}
/* Message in IDE (NetBeans):
Z1 is not abstract and does not override abstract methodY() in Y
*/
//B:
abstract class Z2 extends X implements Y {
public void methodZ() { }
}
//C:
class Z3 extends X implements Y {
public void methodX() { }
}
/* Message in IDE (NetBeans):
Z3 is not abstract and does not override abstract methodY() in Y
*/
//D:
abstract class Z4 extends X implements Y {
public void methodY() { }
}
//E:
public class Z5 extends X implements Y{
public void methodY() {}
}
/* Message in IDE (NetBeans):
Z5 is not abstract and does not override abstract methodY() in Y
*/