Difficulty: Easy
Correct Answer: An object is an instance of a class.
Explanation:
Introduction / Context:
Objects and classes are the bedrock of object-oriented analysis and design. A class defines a type (its structure and behavior), and objects are concrete instances of that type that exist at runtime with specific state.
Given Data / Assumptions:
Concept / Approach:
Distinguish type vs. instance. The type (class) is a blueprint; the instance (object) is a realized entity in memory or persistence with its own attribute values. Therefore, the precise, universally correct statement is that an object is an instance of a class.
Step-by-Step Solution:
Verification / Alternative check:
In code, declaring “new Customer()” creates an object (instance) of class Customer; many such objects can exist simultaneously.
Why Other Options Are Wrong:
Class is an instance of an object is backwards.
Only data ignores methods/behavior, which are intrinsic in OO.
Common Pitfalls:
Assuming a class is merely a “record structure”; in OO it encapsulates both data and operations.
Final Answer:
An object is an instance of a class.
Discussion & Comments