Ask Question
23 May, 03:41

Which of the following could be a constructor for the public class MyClass? a. public MyClass () b. public void MyClass () c. public MyClass (int a, double b)

+3
Answers (1)
  1. 23 May, 07:05
    0
    A) public MyClass ()

    C) public MyClass (int a, double b)

    Explanation:

    In Java Constructors are special methods used to initialize objects of a class and they are called when a new object is created with the new keyword.

    Being a special method a constructor cannot not have a return type ... not even void.

    The name of the constructor must match the name of the class and constructors can also have parameter (s)
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Which of the following could be a constructor for the public class MyClass? a. public MyClass () b. public void MyClass () c. public ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers