import java.util.Scanner;//导入Scanner类
public class text {
public static void main(String[] args)
{
System.out.println("嵌套语句喽!");
Scanner myScanner=new Scanner(System.in);
System.out.println("请输入该歌手的成绩");
double score=myScanner.nextDouble();
if(score >= 8.0) {
System.out.println("请输入性别");
char gender=myScanner.next().charAt(0);
if(gender=='男') {
System.out.println("进入男子组");
}
else if(gender == '女') {
System.out.println("进入女子组");
}
else {
System.out.println("性别有误");
}
}
else {
System.out.println("很遗憾,你被淘汰了");
}
}
}
java嵌套语句
最新推荐文章于 2024-08-15 14:47:41 发布