do while循环
package test.operator;
public class doWhileDemo03 {
public static void main(String[] args) {
//while和do while的区别
int i = 0;
while(i<0){
System.out.println(i);
}
System.out.println("===========");
do{
System.out.println(i);
}while(i<0);
}
}
package test.operator;
public class doWhileDemo02 {
public static void main(String[] args) {
//计算1+2+3...+99+100的和
int i = 1;
double sum = 0;
do{
sum = sum + i;
i++;
}while(i<=100);
System.out.println(sum);
}
}
package test.operator;
public class doWhileDemo01 {
public static void main(String[] args) {
//输出1-100的数字
int i= 1;
do{
System.out.println(i);
i++;
}while(i<=100);
}
}
标签:do,int,while,循环,static,operator,public
From: https://www.cnblogs.com/sara0618/p/17120635.html