"unary + has no effect on the value of its operand,byt the expression is promoted to at least int."-----from Complete Java2 Certification Study Guide.That means -1 will be promoted at least int type.so "byte i=-1;"will results in compile error.But when I comile it,it runs well.Why?
posted 13 years ago
because -1 is a literal, not a var
if RHS is a compile-time constant, and in the range of the LHS, the assignment is accepted by jvm
SCJP 1.4 100% @ Peking, China <br />~~~~~~~~~~~~~~~~~~~~~<br />但使龙城飞将在, 不教胡马度阴山!