Ask Question
25 August, 06:35

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)

+5
Answers (1)
  1. 25 August, 10:15
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers