Multiple choice technology programming languages

Which of the following lines will compile without warning or error

  1. float f=1.3;

  2. int i=10;

  3. char c="a";

  4. byte b=257;

  5. boolean b=null;

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Only option B compiles cleanly. Option A requires 1.3f to avoid loss-of-precision warning. Option C uses double quotes for String instead of single quotes for char. Option D overflows byte range (-128 to 127). Option E is invalid because boolean is a primitive type and cannot be assigned null.