Marco Tedone<br />SCJP1.4,SCJP5,SCBCD,SCWCD
Originally posted by Marco Tedone:
I'm studying the operators and assignments and i have a couple of questions:
1. The author says that implicit narrowing primitive conversions on assignment can occur when the source is an int constant whose value can be determined to be in the range of the destination type at compile time. He also says that the type could be either byte, short or char. In its example the author states that:
byte tiny = (byte) 128; //This because int value is not in range. What does it mean? Is not in range because between byte and int is there short or because of the value?
2. The author says that an int negative value is not determinable and therefore a cast is required, referring to the following example:
int i = -20;
byte b2 = (byte) i; //Value of i not determinable
Why this value is not determinable?
Regards,
Marco
:roll:
Marco Tedone<br />SCJP1.4,SCJP5,SCBCD,SCWCD
Tom
Marco Tedone<br />SCJP1.4,SCJP5,SCBCD,SCWCD