다음 프로그램을 종료하고 콘솔보기의 맨 처음으로 올라가려고하면 처음 두 루프가 실행되지 않습니다. 왜 나 한테 설명 할 수 있니?무한 루프 만 작동합니까?
public class WhileLoop {
public static void main(String[] args) {
double number= 25.2;
int myInt= 0;
int x=365;
while (myInt<9){ // Finite while loop
System.out.println("Hello "+ myInt);
myInt= myInt+1;
}
while(x>0){ //this is running out of year days loop
System.out.println(x);
x=x-1;
System.out.println(x);
}
while (number==25.2){ // an infinite loop
System.out.println("hahaha");
}
}
}
인쇄 중입니다. 오래된 결과물은 결국 사라집니다. – shmosel
파일에서 출력을 캡처하면 첫 번째 루프의 초기 비트를보다 쉽게 볼 수 있습니다. 그래도 큰 파일을 매우 빨리 만들 수 있으므로 프로그램을 빨리 종료해야합니다. –
이제 나는 그것이 처음부터 나타나지만 다시 한번 그것이 결국 분명 해지는 이유를 알았습니다. –