Question: Question A If a class has an abstract method, which of the following statements is NOT true? All non-abstract subclasses of this class must implement
Question A
If a class has an abstract method, which of the following statements is NOT true?
|
| All non-abstract subclasses of this class must implement this method. | |
|
| You can inherit from this class. | |
|
| You can have an object reference whose type is this class. | |
|
| You can construct an object from this class. | |
Question B
Which of the following statements about classes is true?
|
| You can create subclasses from a class declared with the keyword final. | |
|
| You can override methods in a class declared with the keyword final. | |
|
| You can create an object from a class declared with the keyword final. | |
|
| You can extend a class declared with the keyword final. | |
Question C
Consider the following class hierarchy:
public class Vehicle {
private String type;
public Vehicle(String type) {
this.type = type;
System.out.print("Vehicle ");
}
public String displayInfo() {
return type;
}
}
public class LandVehicle extends Vehicle {
public LandVehicle(String type) {
super(type);
System.out.print("Land ");
}
}
public class Auto extends LandVehicle {
public Auto(String type) {
super(type);
System.out.print("Auto ");
}
}
When an object of type Auto is constructed, what will be printed by the constructors from this inheritance hierarchy?
|
| Auto Land Vehicle |
|
| Vehicle Land Auto |
|
| Land Auto Vehicle | |
|
| Auto | |
Question D
What is a class called that represents the most general entity in an inheritance hierarchy?
|
| Inheritance class | |
|
| Superclass | |
|
| Subclass | |
|
| Default class | |
Question E
All rodents are mammals and all canines are mammals. No canines are rodents and no rodents are canines. What hierarchy best captures this information?
|
| Mammal is a superclass of Rodent and Canine | |
|
| Rodent is a superclass of Mammal and Canine is a superclass of Mammal | |
|
| Mammal is a superclass of Canine and Canine is a superclass of Rodent |
|
| Mammal is a superclass of Rodent and Rodent is a superclass of Canine |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
