簡短的原語
short
是 16 位有符號整數。它的最小值為 -2 15 (-32,768),最大值為 2 15 -1(32,767)
short example = -48;
short myShort = 987;
short anotherShort = 17;
short addedShorts = (short) (myShort + anotherShort); // 1,004
short subtractedShorts = (short) (myShort - anotherShort); // 970
short
的最大值和最小值可在以下位置找到:
short high = Short.MAX_VALUE; // high == 32767
short low = Short.MIN_VALUE; // low == -32768
short
的預設值為 0
short defaultShort; // defaultShort == 0