Which of these assignments are not valid?
-
short s = 28
-
byte b = 12
-
float f = 2.3
-
double d = 2.3
C
Correct answer
Explanation
In Java, 2.3 is a double literal by default. Assigning it directly to a float without an f suffix or cast causes a compilation error because of potential precision loss. Option D (double d = 2.3) is valid.