根据输入的年龄, 来打印出当前年龄的人是少年

根据输入的年龄, 来打印出当前年龄的人是少年(低于18), 青年(19-28), 中年(29-55), 老年(56以上)(这道题好像有瑕疵,没得满分,有缘人帮忙看看)
public static void main(String[] args) {
while(true){
System.out.println("请输入要判断的年龄");
Scanner in=new Scanner(System.in);
int age=in.nextInt();
if(age<0){
System.out.println("输入有误,重新输入");
continue;
}
if(age>=0&&age<=18){
System.out.println("少年");
break;
}
if(age>=19&&age<=28){
System.out.println("少年");
break;
}
if(age>=29&&age<=55){
System.out.println("中年");
break;
}
else{
System.out.println("老年");
break;
}
}
}

原文地址:https://www.cnblogs.com/LinYanyan1024-6285/p/14242612.html