01.代码如下:
package TIANPAN;
/**
* 此处为文档注释
*
*/
public class TestDemo {
public static void main(String[] args) {
int num = 130; // 此范围超过了byte定义
byte x = (byte) num; // 由int变为byte
System.out.println(x);
}
}
02.效果如下:
01.代码如下:
package TIANPAN;
/**
* 此处为文档注释
*
*/
public class TestDemo {
public static void main(String[] args) {
int num = 130; // 此范围超过了byte定义
byte x = (byte) num; // 由int变为byte
System.out.println(x);
}
}
02.效果如下:
java中byte, int的转换
1、java程序中默认的整数数值的数据类型为int,默认的小数点数值的数据类型为double。 &n
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M