Java 整數 byteValue() 方法
byteValue() 方法將此 Integer 的值返回為一個位元組。
以下是 Java 中 byteValue() 方法的實現示例 −
示例
public class Main {
public static void main(String[] args) {
Integer val = new Integer(10);
byte res = val.byteValue();
System.out.println("Value = " + res);
}
}輸出
Value = 10
我們再看一個示例 −
示例
import java.util.*;
public class Main {
public static void main(String[] args) {
Byte b = new Byte("10");
byte res = b.byteValue();
System.out.println("Byte = " + b );
System.out.println("Primitive byte = "+ res);
}
}輸出
Byte = 80 Primitive byte = 80
廣告
資料結構
網路
關係型資料庫管理系統
作業系統
Java
iOS
HTML
CSS
Android
Python
C 語言
C++
C#
MongoDB
MySQL
Javascript
PHP