나는 윤년 검사기 인 수업을위한 프로그램을 작성 중이다. 나는 루프가 여전히 무한 루프에 들어간다는 것을 이해하지만 그렇게 작동합니까? Zero는 프로그램을 종료하지 않습니다. 나는 else, if, while, 무엇을 잘못 했는가? 이것은 제 3의 이것을 다시 쓰는 것에 가고, 지금 완전하게 잃어 버렸습니다. -_-. 도움이나 조언을 주시면 감사하겠습니다.내 프로그램의 루프를 빠져 나가는 방법 알아보기
import java.util.Scanner;
public class LeapYearChecker {
public static void main(String[] args){
System.out.println("Please enter a date to find out if the year is a leap year.");
Scanner userInput = new Scanner(System.in);
int year = userInput.nextInt();
while(year == 0)
{
System.out.println();
}
if (year < 1582){
System.out.println("Please enter a date after 1582. The date you entered was" + year + ".");
}if((year % 4 == 0) && (year % 100 !=0) || (year % 400 == 0)){
System.out.println("That is a leap year");
}else{
System.out.println(year +" is not a leap year.");
}
}
}
당신은 할 수있다 루프를 배울 수있는 실제 필요 [이] (http://stackoverflow.com/questions/26287356/learning-basic-loops)는 기본적인 이해를 도울 수 있습니다. – StackFlowed