Advertisements
Advertisements
Question
Which of the following is a valid statement?
Options
A class can have many objects
A class can have only one object
A class cannot have any object
A class can have only two objects
MCQ
Advertisements
Solution
A class can have many objects
Explanation:
A class is simply a reusable blueprint or template. Once you write a class, you can use the new keyword to create an unlimited number of unique objects from it. Each object acts as an independent instance with its own separate data values while sharing the same structure.
shaalaa.com
Is there an error in this question or solution?
Chapter 5: Library Classes - Exercises [Page 133]
