Correct Answer: c) To provide a way for classes to obtain all the properties and behaviors of another class.
Correct Answer: a) It allows methods to perform differently in different instances.
extends keyword signify in a Java class definition?Correct Answer: c) The class is inheriting from a superclass.
*Consider the following classes:
javaCopy code
public class Fruit {
public void flavor() { System.out.println(“Fruit flavor”); }
}
public class Orange extends Fruit {
public void flavor() { System.out.println(“Orange flavor”); }
}
What is this an example of?**
Correct Answer: b) Overriding
Fruit myFruit = new Orange();Orange myOrange = new Fruit();Fruit myFruit = new Fruit();Orange myOrange = new Orange();Correct Answer: a) Fruit myFruit = new Orange();
Correct Answer: c) The type of binding where method calls are resolved at compile time.
super keyword in an overridden method?Correct Answer: a) It calls the overridden method in the superclass.
Correct Answer: b) Through interfaces. (Note: Java does not support multiple inheritances through classes but allows a class to implement multiple interfaces.)
Correct Answer: a) To access methods that the reference type doesn’t have.
super.methodName() and this method is overridden in the subclass?Correct Answer: a) The method in the superclass is called.