Java OCA OCP Practice Question 840

Question

Which of these statements are true?

Select 2 options

  • A. All classes must explicitly define a constructor.
  • B. A constructor can be declared private.
  • C. A constructor can declare a return value.
  • D. A constructor must initialize all the member variables of a class.
  • E. A constructor can access the non-static members of a class.


Correct Options are  : B E

Note

Constructors need not initialize all the member variables of the class.

A non-final member variable will be assigned a default value if not explicitly initialized.




PreviousNext

Related