Which of the following is true about inheritance vs. composition?
Group of answer choices
inheritance uses subclass/superclass relations; composition uses interface implementations
neither inheritance nor composition relies upon superclass/subclass relations
composition uses subclass/superclass relations; inheritance uses interface implementations
both inheritance and composition rely upon superclass/subclass relations
2.
Java performs compile-time type checking based on the __________ type of a variable.
Group of answer choices
immutable
actual
primitive
apparent
3.
What is a class called that represents the more general entity in an inheritance hierarchy?
Group of answer choices
interface
subclass
superclass
default class
4.
Which of the following statements about comparing objects is correct?
Group of answer choices
the equals() method is used to check whether two references are to the same object
the equals() method is used to compare the equivalency of two objects
for all immutable objects, the equals() method and the == operator always behave the same
the == operator is used to compare the equivalency of two objects
5.
All rodents are mammals, and all canines are mammals. No canines are rodents, and no rodents are canines. Which hierarchy best captures this information?
Group of answer choices
Mammal is a superclass of Rodent, and Mammal is a superclass of Canine
Mammal is a superclass of Rodent, and Rodent is a superclass of 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
Answer 1:
inheritance uses subclass/superclass relations; composition uses
interface implementations
Answer 2:Actual type of variable
Answer 3:superclass
all common features are kept at parent class
Answer 4:the equals() method is used to compare the equivalency of
two objects
Answer 5:
Mammal is a superclass of Rodent, and Mammal is a superclass of
Canine
NOTE : PLEASE COMMENT BELOW IF YOU HAVE CONCERNS.
I AM HERE TO HELP YOUIF YOU LIKE MY ANSWER PLEASE RATE AND HELP ME
IT IS VERY IMP FOR ME
Get Answers For Free
Most questions answered within 1 hours.