Following code will result in: int a = 3.5;
-
Compilation error
-
Runtime error
-
a being 3.5
-
a being 3
A
Correct answer
Explanation
In Java, 3.5 is a double literal. Assigning a double value to an int variable without explicit casting causes a compilation error because of potential loss of precision. Java requires explicit type conversion like int a = (int)3.5;