Take the 2-minute tour ×  Possible Duplicate: Eclipse bug? When
is a short not a short?  In Java I can assign a short or a byte
inside blocks like this:  short s = 20000; byte  b = 120;
Because 20000 is a short value and 120 is a byte value, if I
attempt to try:  short s = 67000; byte  b = 128;  I will get an
error that states it cannot compile from int to byte where  byte
b = (byte)12232;  will not even trigger a warning that value may
get lost. In a function call I'm forced to cast it anyways:
void test(short s){} test(1) //invalid test((short)1) //valid
While on return types it is okay again.  short test(){
return 1; //valid  Why does the compiler sometimes deside to
know the bounds of numbers (at least from constants), while it
seem that it forgets it elsewhere?  share|improve this question
marked as duplicate by assylias, SJuan76, EJP, A--C, Stephen C
Jan 28 '13 at 0:48   @assylias a very nice spotting, have you
memorized all java questions? +1 –  SJuan76 Jan 28 '13 at 0:23
uh, well I don't found