1
visibility

What will be the value of s at the end of the program?

class IntegerConversion
{
public static void main(String args[])
{
int i = 50000;
short s = i;
System.out.println(s);
}
}

  • s will be 50000

  • It Will Compile with no output

  • Program will not compile.

  • None

s = i cannot be done since i is of type int and must be typecasted to short explicitly since short is smaller than int (i.e. size of short < size of int). So the program does not compile.