方法一:
public class Test09 {
public static void main(String[] args) {
boolean b = true;
int k = 0 ;
while(b){
for(int i = 0 ; i < 10 ; i ++){
k = i ;
System.out.println(k);
}
}
}
}
较好的方法:
public class Test09 {
public static void main(String[] args) {
int x = 0 ;
while(true){
x = (x+1)%10 ;
System.out.println(x);
}
}
}