Java Ch 9

Ace your homework & exams now with Quizwiz!

17. Constructor are not inherited.

False

19. True or False: If a subclass constructor does not explicitly call a superclass constructor, Java will not call any of the superclass's constructors.

False

20. True or False: An object of a superclass can access members declared in a subclass.

False

22. True or False: When a method is declared with the final modifier, it must be overridden in a subclass.

False

23. True or False: A superclass has a member with package access. A class that is outside the superclass's package but inherits from the superclass can access this member.

False

27. True or False: A class can implement only one interface.

False

28. By default all members of an interface are public

False

10. These superclass members are accessible to subclasses and classes in the same packet.

Protected

18. In a subclass, a call to the superclass constructor can be written only in the subclass constructor

True

21. True or False: The superclass constructor always executes before the subclass constructor.

True

25. True or False: A subclass reference variable can reference an object of the superclass.

True

26. True or False: When a class contains an abstract method, the class cannot be instantiated.

True

8. A method in a subclass having the same signature as a method in the superclass is an example of a. overloading b. overriding c. composition d. an error

b. overriding

13. When a class implements an interface, it must a. overload all of the methods listed in the interface b. provide all of the methods that are listed in the interface, with the exact signatures specified c. not have a constructor d. be an abstract class

b. provide all of the methods that are listed in the interface, with the exact signatures specified

1. In an inheritance relationship, this is the general class. a. subclass b. superclass c. derived class d. child class

b. superclass

16. Abstract classes cannot a. be used as superclasses b. have abstract methods c. be instantiated d. have fields

c. be instantiated

14. Fields in an interface are a. final b. static c. both final and static d. not allowed

c. both final and static

2. In an inheritance relationship, this is the specialized class. a. superclass b. base class c. subclass d. parent class

c. subclass

12. With this type of binding, the Java Virtual Machine determines at runtime which method to call, depending on the type of the object that a variable references. a. static b. early c. flexible d. dynamic

d. dynamic

3. This key word indicates that a class inherits from another class. a. derived b. specialized c. based d. extends

d. extends

11. all classes directly or indirectly inherit from this class.

object

5. This key word refers to an object's superclass. a. super b. base c. this d. parent

super

The following is an explicit call to the superclass's default constructor. a. default(); b. class(); c. super(); d. base();

super()

24. a superclass reference variable can reference an object of a class that inherits from the superclass.

...

4. In a subclass does not have access to these superclass member

...

6. In a subclass constructor, a call to the superclass constructor must

Very first statement

9. A method in a subclass having the same name as a method in the superclass but a different signature, is an example of a. overloading b. overriding c. composition d. an error

a. overloading

15. Abstract methods must be a. overridden b. overloaded c. deleted and replaced with real methods d. declared as private

a. overridden


Related study sets

Legal Dimensions of Nursing Practice (PrepU)

View Set

Foundations: Varcarolis Ch 17 Cognitive Disorders

View Set

A level Computing - Graphs and Trees

View Set

MLI: Ch. 12 Ethical Issues Related to Life

View Set

Operating Leverage, Break-Even and Scenario Analyses (1/25/24)

View Set

Chapt 4 part 2 programs and processing

View Set

Intro to Financial Accounting Midterm 2

View Set