Which of the following statements about constructors is true? 1. A class may have more than one function Object() { [native code] }. 2. They can be inherited. 3. Their address can be referenced to. 4. Constructors cannot be declared in the protected part of the class. 5. Constructors cannot return values.
A. Only 1,2,4
B. 1,2,4,5
C.1,4,5
D.1,3,5
Answer:C
Which of the following statements about constructors is true? 1. A class may have more than one function Object() { [native code] }. 2. They can be inherited. 3. Their address can be referenced to. 4. Constructors cannot be declared in the protected part of the class. 5. Constructors cannot return values.
A. Only 1,2,4 B. 1,2,4,5 C.1,4,5 D.1,3,5
Explanation: 1,4,5A constructor's aim is to initialise a class object, but a method's purpose is to complete a task via running java code. Constructors cannot be abstract, final, static, or synchronised, whereas methods can. Constructors do not have return types, whereas methods do.