Ask Question

Which of the following is NOT true of constructors? Question 6 options

a. A constructor must have the same name as the class itself

b. Constructors never have a return type - not even void

c. Constructors are invoked using the new operator.

+3
Answers (1)
  1. 22 September, 19:59
    0
    All are True

    Explanation:

    a. A constructor must have the same name as that of a class. For example

    public class MyFirstClass{ / / this is the class name

    public MyFirstClass () } / / the constructor having the same name as class.

    b. Constructors never have a return type not even void because it is only used to initialize the values of data members of the class when the object of the class is created so constructors are not directly called hence they do not need to have a return type.

    c. Constructors are invoked using the new operator.

    When the new object is created the constructor is invoked in order to initialize the variables of a class. The memory is allocated to the object and then the constructive is invoked for the purpose to initialize the object.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Which of the following is NOT true of constructors? Question 6 options a. A constructor must have the same name as the class itself b. ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers