입력 처리

Yumi Kim·2025년 4월 3일

Java 알고리즘

목록 보기
18/19
post-thumbnail

1 : 입력되는 테스트케이스의 수를 모를 때

Scanner

		while (sc.hasNextLine()) { // EOF 처리
			String N = sc.nextLine().trim();
			if (N.isEmpty())
				break; // 빈 문자열일 경우 종료

			System.out.println(n);
		}

BufferedReader


		String line = null;
		while ((line = br.readLine()) != null) {
			int n = Integer.parseInt(line);
			
            System.out.println(n);
		}
profile
✿.。.:* ☆:**:. 🎀 Daily Study 🎀 .:**:.☆*.:。.✿

0개의 댓글