Java OCA OCP Practice Question 1328

Question

Which of the following are true about constructors?

  • A. A class inherits its constructors from its parent.
  • B. The compiler supplies a default constructor if no constructors are provided for a class.
  • C. All constructors have a void return type.
  • D. A constructor may throw an exception.


B and D

Note

The compiler supplies a default constructor if no constructors are provided for a class.

Constructors may throw exceptions.

These exceptions must be declared in the constructors' throws clause.




PreviousNext

Related