/**
* 测试ifelse if else
* @author chen_zan_yu
*
*/
public class Kk05 {
public static void main(String[] args) {
int age=(int)(100*Math.random());
System.out.println("年龄是"+age+"属于");
if(age<15) {
System.out.println("儿童,喜欢玩!");
}
else if(age<25) {
System.out.println("青年,要学习!");
}
else if(age<45) {
System.out.println("中年,要工作!");
}
else if(age<65) {
System.out.println("中老年,要补钙!");
}
else if(age<85) {
System.out.println("老年人,要多运动!");
}
else {
System.out.println("老寿星,古来稀!");
}
}
}
要看看你是在哪个阶段的呢
猜你喜欢
转载自blog.csdn.net/chen_zan_yu_/article/details/88593948
今日推荐
周排行