Multiple choice technology programming languages

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

  1. float f=1.3;

  2. char c="a";

  3. byte b=257;

  4. int i=10;

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

Only option D compiles without error. Option A (float f=1.3) requires 'f' suffix or cast because 1.3 is double by default. Option B (char c="a") uses double quotes instead of single quotes. Option C (byte b=257) exceeds byte's max value (255).