三元运算符:
public static void main(String[] args) {
int p1 = 150;
int p2 = 210;
int p3 = 165;
int max = p1 > p2 ? p1 : p2;
int max2 = max > p3 ? max : p3;
System.out.println(max2);
if判断语句:
Scanner sc = new Scanner(System.in);标签:&&,int,System,score,java3,println,out From: https://www.cnblogs.com/tqylqt/p/18158467
System.out.println("请输入一个成绩");
int score = sc.nextInt();
if (score >= 0 && score <= 100) {
if (score >= 95 && score <= 100) {
System.out.println("优秀");
} else if (score >= 90 && score <= 94) {
System.out.println("一般");
} else if (score >= 80 && score <= 89) {
System.out.println("平庸");
} else {
System.out.println("菜鸟");
}
} else {
System.out.println("成绩异常");
}