For this code:
public class Solution{
public static void main(String[] args){
short x = 10;
x = x * 5;
System.out.print(x);
}
}
This will give compile error - “Lossy conversion from int to short”
Why? Short has a maximum value of 32,767, 10 * 5 = 50, so why am I getting this error?