란디의 메모장

#분류

  nextLine()을 사용하자


Scanner의 nextLine()의 메소드의 설명을 보면
Advances this scanner past the current line and returns the input that was skipped. This method returns the rest of the current line, excluding any line separator at the end. The position is set to the beginning of the next line. 
Since this method continues to search through the input looking for a line separator, it may buffer all of the input searching for the line to skip if no line separators are present.

int age = Integer.parseInt(sc.nextLine());


공유하기

facebook twitter kakaoTalk kakaostory naver band