Which of the following statements is false?

Which of the following statements is false?
A. A class can have only one constructor
B. A class can have multiple constructors
C. An object created from a class is referred to as instance of the class
D. An instance of a class is considered an object
 
Answer: A
Explanation: A class can have multiple constructors. A constructor can be empty, can contain arguments; and the attributes of the class are defined, by the way the objects are created using the different constructors. For example, while creating an object, if we pass arguments, then the constructor with arguments are called and the attributes are initialized to some value, else if no arguments are passed while creating objects, then an empty constructor is called by default, and the attributes are initialized to zero.
 

Tìm kiếm

Back
Top