내가 이해하지 못하는 문제가 발생했습니다. nextLine()은 문장이어야합니다. 맞습니까?자바 | 문자열 유형
System.out.println("Enter film's name");
a = scan.nextLine();
System.out.println("What number did the film released?");
b = scan.nextInt();
System.out.println("Who's the director?");
c = scan.nextLine();
System.out.println("How long is the film in minutes?");
d = scan.nextInt();
System.out.println("Have you seen the movie? Yes/No?");
e = scan.next();
System.out.println("Mark for the film?");
f = scan.nextDouble();
이 해제 날짜까지 제대로 실행 한 다음이 함께 "얼마나 오래하면 영화"그것은 일을 가정처럼 작동하지 않습니다 "감독 누구"보여줍니다.
사용 방법 nextLine(); 그리고 왜 저에게 적합하지 않습니까?
실제 문제를 설명해주십시오. –
비슷한 질문에 답변되었습니다. 다음을 참조하십시오 : http://stackoverflow.com/questions/13102045/scanner-is-skipping-nextline-after-using-next-nextint-or-other-nextfoo – shivsky
nextInt는 다음 토큰을 int 값으로 스캔합니다. 그래서 정수 입력을 할 때마다 \ n을 덧붙여 야합니다. –