标签:system struct int stat sys 影响 while循环 停止 class
package com.zhou.struct;
public class WhileDemo01 {
public static void main(String[] args) {
//输出1-100
int i=0;
while (i<100){
i++;
System.out.println(i);
}
}
}
package com.zhou.struct;
public class WhileDemo02 {
public static void main(String[] args) {
//伪代码
while(true){
/*
用于等待客户端连接
定时检查
*/
}
}
}
package com.zhou.struct;
public class WhileDemo03 {
public static void main(String[] args) {
//求1+2+3+......+100=?
int sum=0;
int i=0;
while(i<100){
i++;
sum+=i;
}
System.out.println("sum = "+sum);
System.out.println("i = "+i);
}
}
package com.zhou.struct;
public class DoWhileDemo01 {
public static void main(String[] args) {
//求1+2+3+......+100=?
int sum=0;
int i=0;
do{
sum+=i;
i++;
}while (i<=100);
System.out.println(sum);
}
}
标签:system struct int stat sys 影响 while循环 停止 class
原文地址:https://www.cnblogs.com/junjunboss/p/while.html