Short類的intValue()方法用於返回Short對象對應的int值。
用法
public int intValue()
參數
不適用
返回值
將 Short 值轉換為 int 類型後返回對應的數值。
例子1
public class ShortIntValueExample1 {
public static void main(String[] args) {
Short sValue = 105; //with positive value
// it returns int type value
int result = sValue.intValue();
System.out.println(" Short "+sValue+" converted into intValue is = " + result);
}
}
輸出:
Short 105 converted into intValue is = 105
例子2
public class ShortIntValueExample2 {
public static void main(String[] args) {
Short sValue = -55; //with Negative value
// it returns int type value
int result = sValue.intValue();
System.out.println(" Short "+sValue+" converted into intValue is = " + result);
}
}
輸出:
Short -55 converted into intValue is = -55
相關用法
- Java Short hashCode()用法及代碼示例
- Java Short shortValue()用法及代碼示例
- Java Short compare()用法及代碼示例
- Java Short equals()用法及代碼示例
- Java Short parseShort()用法及代碼示例
- Java Short decode()用法及代碼示例
- Java Short valueOf()用法及代碼示例
- Java Short longValue()用法及代碼示例
- Java Short doubleValue()用法及代碼示例
- Java Short toString()用法及代碼示例
- Java Short byteValue()用法及代碼示例
- Java Short compareTo()用法及代碼示例
- Java Short reverseBytes()用法及代碼示例
- Java Short floatValue()用法及代碼示例
- Java Short compareUnsigned()用法及代碼示例
- Java ShortBuffer rewind()用法及代碼示例
- Java Guava Shorts.min()用法及代碼示例
- Java Guava Shorts.max()用法及代碼示例
- Java ShortBuffer hasArray()用法及代碼示例
- Java ShortBuffer allocate()用法及代碼示例
注:本文由純淨天空篩選整理自 Java Short intValue() Method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。