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








Question

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

  1. A local variable of type boolean defaults to null.
  2. A local variable of type float defaults to 0.
  3. A local variable of type Object defaults to null.
  4. A local variable of type boolean defaults to false.
  5. A local variable of type boolean defaults to true.
  6. A local variable of type float defaults to 0.0.
  7. None of the above.




Answer



G.

Note

G is correct since we must assign value to local variables and local variables do not get assigned default values.