Multiple choice technology programming languages

Which of the following lines will compile without warning or error.

  1. float f=2.3;

  2. char c="z";

  3. boolean b=null;

  4. int i=21;

  5. byte b=257;

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

int i=21; is a valid declaration and compiles successfully. float f=2.3; fails because 2.3 is a double literal. char c="z"; fails because double quotes are for Strings, not chars. boolean b=null; is invalid because boolean is a primitive, and byte b=257; exceeds byte's range.