Inheritance in Object-Oriented Programming
What does the class header “public class B extends C” mean?
Class C is a subclass of Class B
Class C and Class B are subclasses of other classes
Class C is a superclass of Class B
Class C and Class B are superclasses of other classes
In a Java program, Class A and Class B are defined such that both have a method named methodOne() with different implementations, and Class C inherits from both Class A and Class B. If we create an object of Class C and call methodOne(), which version of methodOne() will be called?
Both versions of methodOne() will be called, first Class A’s then Class B’s.
Class C cannot inherit from both Class A and Class B.
Class A’s version of methodOne().
Class B’s version of methodOne().
What are the terms for the classes established in an inheritance relationship?
Lower class and Higher class
Subpar class and Superior class
Subclass and Superclass
Subordinate class and Superior class
If we want to create a Vehicle class and a Truck class, which of the following makes the most sense?
More information is needed to appropriately create the classes.
Making Truck the superclass and Vehicle the subclass.
Making Vehicle and Truck two separate classes without any relationship.
Making Vehicle the superclass and Truck the subclass.
If we want Class Senior to be a subclass of Class Student, what should its header be?
public class Student extends Senior
public class Senior extends Student
public subclass Senior, Student
public class Senior sub Student
If classes E and F are created using the headers “public class E extends C” and “public class F extends C” respectively, what is true about them?
Class E and Class F have access to all of each other’s instance variables and methods
All of Class E’s and all of Class F’s instance variables and methods can be accessed by Class C
Class E and Class F both have access to all of Class C’s instance variables and methods
Class E has access to all of Class F’s instance variables and methods, but Class F does not have access to any of Class E’s instance variables and methods
In Java, a class can inherit from:
As many superclasses as it wants to
At most three superclasses
At most one superclass
At most two superclasses

How are we doing?
Give us your feedback and let us know how we can improve
Consider the following class hierarchy: Class Animal contains objects like dog, cat, and bird, and Class WildAnimal, a subclass of Class Animal, contains objects like lion and tiger. Which of the following statements is true?
All WildAnimal objects are also Animal objects, but not all Animal objects are WildAnimal objects.
No WildAnimal object is also an Animal object, and vice versa.
All Animal objects are also WildAnimal objects, but not all WildAnimal objects are Animal objects.
All WildAnimal objects are also Animal objects, and vice versa.
What is the purpose of superclasses in object-oriented programming?
To create instances of other classes
To create instances of objects
To inherit attributes and methods from another class
To let other classes inherit attributes and methods from it
Which keyword is used in the class header to create a subclass in Java?
extends
this
abstract
super