Auto commit

上级 5b0ce43e
class Main { class Main {
public static void main(String[] args) { public static void main(String[] args) {
System.out.println("Hello world!"); //变量基础的易错点
//1)变量的
long a = 10000000000L; //long后面加F
System.out.println(a);
float b = 3.14F; //float后加F
System.out.println(b);
//double的精度不足,输出时易发生误差
double c=3.14,d=7.62;
System.out.println(d-c);
//类型转换的易错点
byte a1,a2;
a1 = 5; a2 = 7;
//两个变量相加类型自动转为int类型需强转
byte a3 = (byte)(a1+a2);//括号内类型与前面一定要一致
System.out.println(a3);
//变量的命名能用的有哪些
int _$a1 = 5;
//变量的命名只能用两种符号_、$字母和数字并且不能以数字开头
System.out.println(_$a1);
//输出的易错
int j = 1;
System.out.println("j"); //双引号内仅输出字符,与他的变量无关
System.out.println(j); //输出1
} }
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册