(Scanner Input=new Scanner(System.in))
Input.hasNext()
조건을 가진 프로그램에서 while
루프가 있습니다. Input.nextLine();
Input.nextLine();
Input.nextLine();
Input.nextLine();
.next()
.next()
.next()
.next()
.next()
.next()
.next()
.next()
.next()
.next()
.next()
.next()
.next()
.next()
.next()
.next()
.next()
.next()
.next()
한 줄을 읽은 후 while
루프를 끊을 수있는 방법 또는 while 루프를 입력하여 중단 할 수있는 방법은 무엇입니까? 개행 문자?hasNext() 조건을 가진 루프를 멈춘다.
while (Input.hasNext()) {
if (Input.hasNextFloat()) {
Grade=Input.nextFloat();
P.setGrades(Grade);
j=0;k=1;
continue;
}
if (k==1) {
P.getGPA();
P=new Person();
k=0;
}
if (j==1) {
P.setLastName(Input.next());
continue;
}
P.setFirstName(Input.next());
i++;
j=1;
}
안녕하세요. 감사합니다. –