var = scanner.next()는 띄어쓰기를 기준으로 문자열을 인식합니다.

var=scanner.nextLine()는 엔터를 기준으로 문자열을 인식합니다.

 

Hello world를 입력했을 때의 결과값은 NextLine()일때는 hello world 전체가 출력되었고 Next()의 결과값은 hello가 출력되었습니다.

 

 

+ Recent posts