publicclassTest{
publicstaticvoid main(String args[]){
int i =3/2;
System.out.println(i);
}
}
publicclassTest{
publicstaticvoid main(String args[]){
int i =5;
int j = i+++5;
System.out.println(i);
System.out.println(j);
}
}
- 要点三: = 与 == 的区别?
- = :是赋值号,== 是判断左右两边是否相等并返回boolean值。
publicclassTest{
publicstaticvoid main(String args[]){
int i =5;
int j =6;
boolean b = i == j;
System.out.println(b);
}
}
- 逻辑运算符
- 短路与 a && b,会先判断a的真假,若为假,后面的b不运算。而逻辑与 a & b,都会运算。
- publicclassTest{
- publicstaticvoid main(String args[]){
- boolean a =true;
- boolean b =false;
- boolean c = a & b;
- boolean d = a && b;
- System.out.println(c);
- System.out.println(d);
- int i =5;
- boolean e = i >6&& i++>7;
- System.out.println(e);
- System.out.println(i);
- }
- }
posted @
2016-08-28 16:49
ArronEve
阅读(
189)
评论()
编辑
收藏
举报