Which of the following statements about constructor overloading in Java is correct?

  • Constructor overloading allows a class to have multiple constructors with the same name but different parameters.
  • Constructor overloading is not supported in Java.
  • Constructor overloading requires that all constructors have the same number of parameters.
  • Constructor overloading can only be used in abstract classes.
a) is correct. Constructor overloading in Java enables a class to have multiple constructors with the same name but different parameters. This allows for creating objects with various initializations. b) and d) are incorrect statements. c) is also incorrect because the number of parameters can vary among overloaded constructors.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *