import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String sentence;
while(sc.hasNextLine()) {
sentence = sc.nextLine();
System.out.println(sentence);
}
}
}
hasNextLine() 메서드는 boolean 형태로 값을 반환한다. 읽을 값이 있으면 true, 없으면 false를 반환한다.
nextLine이므로 줄 단위로 받는다.
'Algorithm > Baekjoon' 카테고리의 다른 글
[백준_JAVA] 3003 킹, 퀸, 룩, 비숍, 나이트, 폰 (0) | 2023.07.27 |
---|---|
[백준_JAVA] 25083 새싹 (0) | 2023.07.25 |
[백준_JAVA] 5622 다이얼 (0) | 2023.07.25 |
[백준_JAVA] 2908 상수 (0) | 2023.07.22 |
[백준_JAVA] 1152 단어의 개수 (0) | 2023.07.17 |