(From the documentation
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Math.html )
The line
(where x1 and x2 are byte variables) invokes the method above that is marked with a **. The return type of this method is an int.
This is what the compiler looks at. That it returns an int.
So, to the compiler you are telling it to assign an int to a byte. Assigning an int to a byte requires a cast. The compiler doesn't calculate what the value is of that int.
The only exception is the following:
Here, the compiler can see that c = -128 is being assigned a literal. It notes that the literal is within a valid range of a byte so it allows this.
Also in the case where it assigns b = i where i is a final int, this gets resolved at compile time, and the compiler knows what the value is at compile time, so it allows this.
Hmmm... I'm still working towards that 90. Any hope of that happening?
-Louie
[ September 04, 2004: Message edited by: Louie van Bommel ]