Multiply an int and a short and you'll get an int.
Divide a short by a byte and you'll get an int.
public class MainClass{
public static void main(String[] argv){
byte a = 3; // 3 fits in a byte
byte b = 8; // 8 fits in a byte
byte c = b + c; // 11 fits in a byte. Type mismatch: cannot convert from int to byte
c = (byte) (a + b);
System.out.println();
}
}
|