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








Question

Which of the following lines of code compile? (Choose all that apply)

  1. int i1 = 1_234;
  2. double d1 = 1_234_.0;
  3. double d2 = 1_234._0;
  4. double d3 = 1_234.0_;
  5. double d4 = 1_234.0;
  6. None of the above.




Answer



A, E.

Note

Underscores must be directly between two other digits.

The underscore cannot be put adjacent to the decimal point.

The underscore cannot be the last character.