Multiple choice

What will be output of the following code? public class Two { public static void main(String arg[]) { long bvalue=99L; int squased = (int) bvalue; System.out.println(squased); } }

  1. Compile time error

  2. Run time error

  3. 99.000000000000

  4. 99

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

A long value (99L) is explicitly cast to an int using (int) bvalue. Since 99 fits within the range of int (-2^31 to 2^31-1), the cast succeeds without data loss. The output is simply 99, not 99.0 or any decimal representation.