Home Article Practice DemoDataTypeChange

DemoDataTypeChange

2020-12-17 22:26  views:862  source:小键人589554    

public class DemoDataTypeChange {
public static void main(String[] args) {
/* int a=10;
int b=20;
int c=a+b;
System.out.println(c);*/
//自动转换:将取值范围小的类型,自动提升为取值范围大的类型
int i=1;
byte b=2;
//int类型和byte类型运算,结果是int类型
int c=b+i;
//自动类型转换的格式:范围大的数据类型 变量=范围小的数据类型值
double d=100;
}
}



Disclaimer: The above articles are added by users themselves and are only for typing and communication purposes. They do not represent the views of this website, and this website does not assume any legal responsibility. This statement is hereby made! If there is any infringement of your rights, please contact us promptly to delete it.

字符:    改为:
去打字就可以设置个性皮肤啦!(O ^ ~ ^ O)