int a = 10;
long b = 20;
short c = (short)(a + b);What is the data type of the expression `(a + b)` before the cast?
int a = 10;
long b = 20;
short c = (short)(a + b);What is the data type of the expression `(a + b)` before the cast?
int
long
short
float
double
Correct answer
long
In Java, binary numeric promotion applies. Since `a` is `int` and `b` is `long`, the `int` is promoted to `long`, and the result is `long`.