Java OCA OCP Practice Question 538

Question

Which of the following are true?

Choose all that apply

  • A. An instance variable of type double defaults to null.
  • B. An instance variable of type int defaults to null.
  • C. An instance variable of type String defaults to null.
  • D. An instance variable of type double defaults to 0.0.
  • E. An instance variable of type int defaults to 0.0.
  • F. An instance variable of type String defaults to 0.0.
  • G. None of the above.


C, D.

Note

Option C is correct because all non-primitive values default to null.

Option D is correct because float and double primitives default to 0.0.

Options B and E are incorrect because int primitives default to 0.




PreviousNext

Related