• Home
  • Textbooks
  • Introduction to Programming with Java: A Problem Solving Approach
  • Aggregation, Composition, and Inheritance

Introduction to Programming with Java: A Problem Solving Approach

John S. Dean, Raymond H. Dean

Chapter 12

Aggregation, Composition, and Inheritance - all with Video Answers

Educators


Chapter Questions

01:47

Problem 1

In a UML diagram, what does an asterisk (") indicate?

Jennifer Stoner
Jennifer Stoner
Numerade Educator
01:47

Problem 2

In a UML diagram, what does a solid diamond indicate?

Jennifer Stoner
Jennifer Stoner
Numerade Educator
01:20

Problem 3

Explain how using an inheritance hierarchy can lead to code reusability.

Pawan Yadav
Pawan Yadav
Numerade Educator
02:22

Problem 4

What are two synonyms for a superclass?

Jessica Wooten
Jessica Wooten
Numerade Educator
01:29

Problem 5

What are two synonyms for a subclass?

Aditya Sood
Aditya Sood
Numerade Educator
00:57

Problem 6

How do you tell the compiler that a particular class is derived from another class?

Aditya Sood
Aditya Sood
Numerade Educator
00:22

Problem 7

Based on the UML diagram in Figure $12.9,$ an instance of the Part $\mathrm{T}$ ime class includes the following instance variables: name and id. (T / F)

Ashley High
Ashley High
Numerade Educator
01:11

Problem 8

In a subclass's constructor, what do you have to do if you want to begin the constructor with a call to the superclass's zero-parameter constructor?

Aditya Sood
Aditya Sood
Numerade Educator
02:00

Problem 9

If a superclass and a subclass define methods having the same name and the same sequence of parameter types, and an object of the subclass calls the method without specifying which version, Java generates a runtime error. (T / F).

SS
Sarvesh Somasundaram
Numerade Educator
01:19

Problem 10

If a subclass method overrides a method in the superclass, is it still possible to call the method in the superclass from the subclass?

Manik Pulyani
Manik Pulyani
Numerade Educator
01:38

Problem 11

If a superclass declares a variable to be private, can you access it directly from a subclass?

Aditya Sood
Aditya Sood
Numerade Educator
01:48

Problem 12

If you wish to call a superclass method, you must always prefix the method name with super. (T / F)

Foster Wisusik
Foster Wisusik
Numerade Educator
01:45

Problem 13

A final method is called "final" because it's allowed to contain only named constants, not regular variables. (T / F)

Arin Asawa
Arin Asawa
Numerade Educator
01:30

Problem 14

Composition and inheritance are alternative programming techniques for representing what is essentially the same kind of real-world relationship. (T $\overline{/ \mathrm{F}}$ ).

Jennifer Stoner
Jennifer Stoner
Numerade Educator
03:15

Problem 15

A Deck is a group of cards and a Deck has a group of cards. In our example, it's better to choose the is-a relationship and implement inheritance. In this case, why is inheritance a better choice than composition?

Jennifer Stoner
Jennifer Stoner
Numerade Educator
01:18

Problem 16

It's possible to support an association with references, variables, and methods in existing classes. What's the advantage of using an association class instead?

Jennifer Stoner
Jennifer Stoner
Numerade Educator