Multiple Choice Question

Quiz Guidelines

 

QID: 
380
Question: 

Given the following code, which statements are true?

interface Automobile { String describe(); }
class FourWheeler implements Automobile{
String name;
public String describe(){ return " 4 Wheeler " + name; }
}
class TwoWheeler extends FourWheeler{
String name;
public String describe(){ return " 2 Wheeler " + name; }
}

Select 3 options

A. An instance of TwoWheeler is also an instance of FourWheeler.
B. An instance of TwoWheeler is a valid instance of Automobile.
C. The use of inheritance is not justified here because a TwoWheeler is not really a FourWheeler.
D. The code will compile only if name is removed from TwoWheeler.
E. The code will fail to compile.

Q&A Set: 

Search the Web

Custom Search

Searches whole web. Use the search in the right sidebar to search only within javajee.com!!!