网站要能被搜到需要做推广嘛,wordpress服装插件,南阳做做网站,厦门百度推广优化排名/*if语句的格式3#xff1a;if(比较表达式1) {语句体1;}else if(比较表达式2) {语句体2;}else if(比较表达式3) {语句体3;}...else {语句体n1;}执行流程#xff1a;首先计算比较表达式1看其返回值是true还是false#xff0c;如果是true#xff0c;就执行语句体1#xff0c…/*if语句的格式3if(比较表达式1) {语句体1;}else if(比较表达式2) {语句体2;}else if(比较表达式3) {语句体3;}...else {语句体n1;}执行流程首先计算比较表达式1看其返回值是true还是false如果是true就执行语句体1if语句结束。如果是false接着计算比较表达式2看其返回值是true还是false如果是true就执行语句体2if语句结束。如果是false接着计算比较表达式3看其返回值是true还是false...如果都是false就执行语句体n1。*/importjava.util.Scanner;classIfDemo5 {public static voidmain(String[] args) {//需求键盘录入一个成绩判断并输出成绩的等级。/*90-100 优秀80-90 好70-80 良60-70 及格0-60 不及格*///创建键盘录入对象Scanner sc newScanner(System.in);//录入数据System.out.println(请输入你的考试成绩);int score sc.nextInt();/*if(score90 score100) {System.out.println(优秀);}else if(score80 score90) {System.out.println(好);}else if(score70 score80) {System.out.println(良);}else if(score60 score70) {System.out.println(及格);}else {System.out.println(不及格);}*///这样写已经满足我的基本要求但是可能别人在使用的时候不会按照你要求的数据给出了。//在做一个程序的基本测试的时候一定要考虑这样的几个问题//正确数据错误数据边界数据。//而我们刚才写的程序并没有处理错误数据所以这个程序不是很好要改进/*if(score90 score100) {System.out.println(优秀);}else if(score80 score90) {System.out.println(好);}else if(score70 score80) {System.out.println(良);}else if(score60 score70) {System.out.println(及格);}else if(score0 score60){System.out.println(不及格);}else {System.out.println(你输入的成绩有误);}*///另一种判断改进if(score0 || score100) {System.out.println(你输入的成绩有误);}else if(score90 score100) {System.out.println(优秀);}else if(score80 score90) {System.out.println(好);}else if(score70 score80) {System.out.println(良);}else if(score60 score70) {System.out.println(及格);}else{System.out.println(不及格);}}}