Mastering Java: The Ultimate Quiz for 'Thinking in Java'

Disable ads (and more) with a membership for a one time $2.99 payment

Mastering Java: The Ultimate Quiz for 'Thinking in Java'. Dive deep into Java with multiple-choice questions. Challenge yourself with quiz questions designed to test and improve your understanding of the 'Thinking in Java' book. Get ready for your exam!

Practice this question and more.


What term best describes the practice of using existing types to create a new type?

  1. Abstraction

  2. Encapsulation

  3. Inheritance

  4. Composition

The correct answer is: Composition

One possible explanation could be The term that best describes the practice of using existing types to create a new type is composition. This means combining different types to create a new type that has its own unique set of features. Using abstraction involves hiding complex implementation details, while encapsulation is the practice of keeping related data and behavior together. Inheritance involves creating new types based on existing types, but the resulting type still has some similarities to the original type. However, composition allows for more flexibility and freedom in creating new types by incorporating features from multiple existing types.