I am confused about datatype conversion in Java. Why does this code work:
long q = 5;
long r = 4;
int p = 0;
p -= q * r;
while the code below gives a compile error?
Type mismatch: cannot convert from long to int
long q = 5;
long r = 4;
int p = 0;
p = p - q*r;
How is explicit subtraction handled in Java as opposed to explicit subtration?