我怎么能重写这段代码,以便我可以为青少年展示:“你是青少年”,对于12岁及以下的人来说,“你是小孩”,对于年龄大于10岁的人来说,“你是成年人” 19?
int age = 15;
if (age >= 13)
if (age <= 19)
System.out.printf("Your are a teenager\n");
答案 0 :(得分:0)
这是怎么回事?
if (age <= 12)
System.out.printf("You are a kid\n");
else if (age <= 19)
System.out.printf("You are a teenager\n");
else
System.out.printf("You are an adult\n");