import java.util.Scanner;
public class 嵌套if选择结构 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("请输入比赛成绩:");
double score = input.nextDouble();
System.out.println("请输入性别:");
String gender = input.next();
if (score <= 10){
if (gender.equals("男")){
System.out.println("进入男子组");
}else if (gender.equals("女")){
System.out.println("进入女子组");
}
System.out.println("进入决赛");
}else {
System.out.println("淘汰");
}
}
}
代码中运用到,在if判断性别时用到可以运行看一下