标签:mamicode else str http src char 合格 mic int()
if单选择结构
if双选择结构
ifif多选择结构
public class IfDemo03 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("请输入成绩");
int score = scanner.nextInt();
if(score==100) {
System.out.println("满分");
}else if (score<100 && score>80){
System.out.println("A级");
}else if(score<80 && score>60){
System.out.println("B级");
}else if (score<60){
System.out.println("不及格");
}else{
System.out.println("成绩不合法");
}
scanner.close();
}
}
public class SwitchDemo01 {
public static void main(String[] args) {
//case 穿透 //switch 匹配一个具体的值
//字符的本质还是数字
//反编译
char grade = ‘C‘;
switch (grade){
case ‘A‘ :
System.out.println("优秀");
break;//可选
case ‘B‘ :
System.out.println("良");
break;//可选
case ‘C‘ :
System.out.println("合格");
break;//可选
default:
System.out.println("未知");
}
}
}
标签:mamicode else str http src char 合格 mic int()
原文地址:https://www.cnblogs.com/styh/p/14495089.html