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