package operation;
public class Demo4 {
public static void main(String[] args) {
boolean a = true;
boolean b = false;
System.out.println("a&&b:"+(a&&b));
System.out.println("a||b:"+(a||b));
System.out.println("!a:"+(!a));
System.out.println("--------------------------");
int c = 3;
boolean d = (c<2)&&(c++<3);
System.out.println(c);
System.out.println(d);
}
}
-------------------------------------
a&&b:false
a||b:true
!a:false
--------------------------
3
false
进程已结束,退出代码为 0
-------------------------------------
package operation;
public class Demo5 {
public static void main(String[] args) {
int a = 10;
int b = 20;
System.out.println(""+a+b);
System.out.println(a+b+"");
System.out.println("--------------------");
int score = 100;
String mathScore = score < 60 ? "不及格":"及格";
System.out.println(mathScore);
}
}
----------------------------------------
1020
30
--------------------
及格
进程已结束,退出代码为 0
|