// Bad short shortNum; int i = 32768; shortNum = (short) i; // problem after statment excution // the shortNum variable has an uninitialized value, // Good try { shortNum = checked((short)i); // solution } catch(OverflowException efx) {}
沒有留言:
張貼留言