hasNext1 [백준 10951번 ː 자바(JAVA)] A+B - 4 두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()) { int a = sc.nextInt(); int b = sc.nextInt(); System.out.println(a+b); } } } 이 문제의 경우 문제에 따로 제시된 제한 조건이 없어서 hasNext() 메소드를 사용해야합니다. - hasNext() : 다음 요소가 있는지 판별하는 메소드. 입력이 있.. 2020. 4. 18. 이전 1 다음