Can a constructor return a value in Java?

  • Yes, a constructor can return a value, which is the default value of the class's primary data type.
  • No, constructors cannot return values in Java.
  • A constructor can return values, but only if it has the same name as the class.
  • A constructor can return values, but they must be of type 'void.'
b) is correct. Constructors in Java cannot return values, and their return type is always 'void.' a), c), and d) are incorrect statements.
Add your answer
Loading...

Leave a comment

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