if if语句之后再有if if 语句为什么就不执行后边的语句了?代码如下
packagecom.zskj.nine;importjava.util.Scanner;publicclassQq{publicstaticvoidmain(Strin...
package com.zskj.nine;
import java.util.Scanner;
public class Qq {
public static void main(String[] args) {
int a;
int b;
int c;
Scanner sc = new Scanner(System.in);
System.out.print("输入第一个数:");
a = sc.nextInt();
System.out.print("输入第二个数:");
b = sc.nextInt();
System.out.print("输入第三个数:");
c = sc.nextInt();
if (a > b) {
if (c > a) {
System.out.println(b + "\t" + a + "\t" + c);
} else if (b > c) {
System.out.println(c + "\t" + b + "\t" + a);
} else {
System.out.println(b + "\t" + c + "\t" + a);}
if (b > a) {
if (c > b) {
System.out.println(a + "\t" + b + "\t" + c);
} else if (c > a) {
System.out.println(a + "\t" + c + "\t" + b);
} else {
System.out.println(c + "\t" + a + "\t" + b);
}
}
}
}
} 展开
import java.util.Scanner;
public class Qq {
public static void main(String[] args) {
int a;
int b;
int c;
Scanner sc = new Scanner(System.in);
System.out.print("输入第一个数:");
a = sc.nextInt();
System.out.print("输入第二个数:");
b = sc.nextInt();
System.out.print("输入第三个数:");
c = sc.nextInt();
if (a > b) {
if (c > a) {
System.out.println(b + "\t" + a + "\t" + c);
} else if (b > c) {
System.out.println(c + "\t" + b + "\t" + a);
} else {
System.out.println(b + "\t" + c + "\t" + a);}
if (b > a) {
if (c > b) {
System.out.println(a + "\t" + b + "\t" + c);
} else if (c > a) {
System.out.println(a + "\t" + c + "\t" + b);
} else {
System.out.println(c + "\t" + a + "\t" + b);
}
}
}
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询