for (int i = 1; i <= 10; i++) {
// 每次循环时累加求和
sum = sum + i;
// 判断累加值是否大于20,如果满足条件则退出循环
if ( sum>20 )
break;}
System.out.print("当前的累加值为:" + sum);
// 每次循环时累加求和
sum = sum + i;
// 判断累加值是否大于20,如果满足条件则退出循环
if ( sum>20 )
break;}
System.out.print("当前的累加值为:" + sum);
2021-10-24
public class HelloWorld {
public static void main(String[] args) {
int age=25;
if(age>=18){
System.out.println("成年");
}else{
System.out.println("未成年");
public static void main(String[] args) {
int age=25;
if(age>=18){
System.out.println("成年");
}else{
System.out.println("未成年");
2021-10-23
public class HelloWorld {
public static void main(String[] args) {
int age=25;
if (age>60) {
System.out.println("老年");
} else if (age>40) {
System.out.println("中年");
} else if (age>18) {
System.out.println("少年");
} else {
System.out.println("童年");
}
}
public static void main(String[] args) {
int age=25;
if (age>60) {
System.out.println("老年");
} else if (age>40) {
System.out.println("中年");
} else if (age>18) {
System.out.println("少年");
} else {
System.out.println("童年");
}
}
2021-10-23
最新回答 / weibo_慕移动5037871
if(age>60){ System.out.println("老年"); } else if(age>40&&age<60){ System.out.println("中年"); } else if(age>18&&age<40){ System.out.println("少年"); } else if(18>age){ ...
2021-10-23
public class HelloWorld {
public static void main(String[] args) {
int one = 20 ;
if(one%2==0)
System.out.println("one是偶数");
}
}
public static void main(String[] args) {
int one = 20 ;
if(one%2==0)
System.out.println("one是偶数");
}
}
2021-10-21
public class HelloWorld{
public static void main(String[] args) {
int score=68;
String mark =(68>60)?"合格":"不合格";
System.out.println("考试成绩如何:"+mark);
}
}
public static void main(String[] args) {
int score=68;
String mark =(68>60)?"合格":"不合格";
System.out.println("考试成绩如何:"+mark);
}
}
2021-10-21