I'm learning java and creating some simple test programs with notes in them and I'm getting an error saying "incompatible types: possible lossy conversion from int to short" with short shortVal= val5 + val6; I'm looked and this error meaning I'm trying to put an int value into a short variable but the value I'm storing in the short is only 27, so I'm a bit confused as to what is wrong.
public class test{
public static void main(String[] args){
double val1=4;
float val2=9;
long val3=30;
int val4= 8;
short val5= 15;
short val6=12;
byte val7=20;
short shortVal= val5 + val6; //why the error here?
}
}