//在处理大数字时候注意内存溢出问题
int i=10_0000_0000; //jdk7 中数字之间可以加入下划线不影响输出
System.out.println(i);
int year =20;
System.out.println(i * year); //内存溢出
long total=i*year;
System.out.println(total); // 内存溢出
long total1 = i*(long) year; //转换long后进行运算
System.out.println(total1);
2.转换的精度问题,a=true if(a)
int i=128;
byte b=(byte)i;
System.out.println(i); //128
System.out.println(b); //-128 内存溢出
/*1.不对Boolean值进行转换
2.不能将对象转成不相干的类型
3.在把高容量转换到低容量的时候,强制转换
4.转换的时候可能存在内存溢出,或者精度问题
* */
boolean a=true;
if (a==true){}
if (a){}
// if (a==true){} 等价于 if (a){}
3.逻辑运算符,运算符
// 逻辑运算符 &&逻辑与 ||逻辑或
/**
* &&逻辑与 两个都为真,结果才是真
* ||逻辑或 有一个为真,结果就是真
*/
boolean a=true;
boolean b=false;
System.out.println(a&&b);
System.out.println(a||b);
/**
* 短路与,短路或
*
*/
int c=5;
boolean d = (c>5)&&(c++>5); // 如果前者是假,运行时,不会进行后面的计算,直接输出运行结果false
System.out.println(c); // c并没有执行++
System.out.println(d); // fasle
4.字符串拼接顺序问题,三元运算符
//字符串的拼接
// ""+任何=字符串
int a=10;
int b=20;
//字符串在前面,整体变成字符串,字符串在最后,先运算前面的结果再变成字符串
System.out.println(""+a+b); //1020
System.out.println(a+b+""); //30
//三元运算符 x ? y:z x为真返回y 反之则返回z
int d=60;
String s= (d>=60) ? "及格":"不及格"; //熟练掌握
System.out.println(s);
5.javadoc 的生成方法,1-dos命令方法 2-idea 软件生成
1-dos命令 -----------------目录前面加上cmd+空格


输入javadoc -encoding utf-8 -charset utf-8 .java文件



2--------------- idea生成方法



浙公网安备 33010602011771号