A) A class can directly inherit from class Object.
B) It's often much more efficient to create a class by inheriting from a similar class than to create the class by writing every line of code the new class requires.
C) If the class you're inheriting from declares instance variables as private,the inherited class can access those instance variables directly.
D) A class's instance variables are normally declared private to enforce good software engineering.
Correct Answer
verified
Multiple Choice
A) public access.
B) package access.
C) private access.
D) block scope.
Correct Answer
verified
Multiple Choice
A) whether two references refer to the same object in memory.
B) whether two references have the same type.
C) whether two objects have the same instance variables.
D) whether two objects have the same instance variable values.
Correct Answer
verified
Multiple Choice
A) keyword super,followed by a dot (. ) .
B) keyword super,followed by a set of parentheses containing the superclass constructor arguments.
C) keyword super,followed by a dot and the superclass constructor name.
D) None of the above.
Correct Answer
verified
Multiple Choice
A) by calling private methods declared in the superclass.
B) by calling public or protected methods declared in the superclass.
C) directly.
D) All of the above.
Correct Answer
verified
Multiple Choice
A) All methods can be inherited.
B) All instance variables can be uniformly accessed by subclasses and superclasses.
C) Objects of a subclass can be treated like objects of their superclass.
D) None of the above.
Correct Answer
verified
Multiple Choice
A) a compile-time error.
B) a syntax error.
C) infinite recursion.
D) a runtime error.
Correct Answer
verified
Multiple Choice
A) Employee/Hourly Employee.
B) Vehicle/Car.
C) Sailboat/Tugboat.
D) None of the above.
Correct Answer
verified
Multiple Choice
A) private.
B) public.
C) protected.
D) package.
Correct Answer
verified
Multiple Choice
A) base.
B) this.
C) public.
D) super.
Correct Answer
verified
Multiple Choice
A) changeText.
B) setText.
C) changeLabel.
D) setLabel.
Correct Answer
verified
Multiple Choice
A) inheritance,the "copy-and-past" approach.
B) the "copy-and-paste" approach,inheritance.
C) a class that explicitly extends Object,a class that does not extend Object.
D) a class that does not extend Object,a class that explicitly extends Object.
Correct Answer
verified
Multiple Choice
A) Image.
B) Icon.
C) ImageIcon.
D) IconImage.
Correct Answer
verified
Multiple Choice
A) knows-a relationship.
B) has-a relationship.
C) uses-a relationship.
D) is-a relationship.
Correct Answer
verified
Multiple Choice
A) A subclass is often larger than its superclass.
B) A superclass object is a subclass object.
C) The class following the extends keyword in a class declaration is the direct superclass of the class being declared.
D) Java uses interfaces to provide the benefits of multiple inheritance.
Correct Answer
verified
Multiple Choice
A) empty copy.
B) deep copy.
C) full copy.
D) shallow copy.
Correct Answer
verified
Multiple Choice
A) Integer.
B) Object.
C) String.
D) Class.
Correct Answer
verified
Multiple Choice
A) A syntax error occurs.
B) A compile-time error occurs.
C) A run-time error occurs.
D) The program compiles and runs because the instance variables are initialized to their default values.
Correct Answer
verified
Multiple Choice
A) Overloaded methods have the same signature.
B) Overridden methods have the same signature.
C) Both of the above.
D) Neither of the above.
Correct Answer
verified
Multiple Choice
A) private instance variables and methods.
B) protected instance variables and methods.
C) private constructors.
D) protected constructors.
Correct Answer
verified
Showing 1 - 20 of 22
Related Exams