Line 4 is a narrowing primitive conversion (see
JLS 2e 5.1.3), which normally requires a cast. There is a special case, however, that doesn't. If the left-hand side of an assignment is a variable of type <code>byte</code>, <code>char</code>, or <code>short</code> and the right-hand side is a constant expression of type <code>char</code>, <code>byte</code>, <code>short</code>, or <code>int</code> which is representable in the left-hand variable, then the assignment is allowed without an explicit cast. See
JLS 2e 5.2.
Since <code>1</code> is representable in a <code>char</code> variable, the compiler allows the assignment. If you'd used a constant expression outside the allowable range for <code>char</code> then you'd get a compile-time error.
jply
[This message has been edited by Jerry Pulley (edited September 22, 2000).]