OCA Java SE 8 Building Blocks - OCA Mock Question Building Block 7








Question

Which of the following are true? (Choose all that apply)

  1. An instance variable of type int defaults to null.
  2. An instance variable of type double defaults to null.
  3. An instance variable of type String defaults to null.
  4. An instance variable of type double defaults to 0.0.
  5. An instance variable of type String defaults to 0.0.
  6. An instance variable of type int defaults to 0.0.
  7. None of the above.




Answer



C, D.

Note

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

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

int primitives default to 0.

String defaults to null.