Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Question: Explain the concept of composition in Java.
Answer: Composition involves creating complex objects by combining simpler objects. It allows for better code organization and reusability.

Example:

class Car {
  Engine engine;
  // other properties and methods
}
Is it helpful? Yes No

Most helpful rated by users:

©2025 WithoutBook