포스트

[Java] Baekjun number 1000 - A+B

This article summarizes the basic input/output solution for adding two integers received in Java.

한국어 원문은 여기에서 볼 수 있습니다.
[Java] Baekjun number 1000 - A+B

BaekJoon 1000

Solution

1
2
3
4
5
6
7
8
9
10
11
12
import java.util.Scanner;

public class Main {
    public static void main (String args[]) {
        Scanner input = new Scanner(System.in);
        
        int num1 = input.nextInt();
        int num2 = input.nextInt();
        
        System.out.print(num1 + num2);
    }
}

Scanner 클래스

  • Import the Scanner class to receive input.
    1
    
    import java.util.Scanner
    
  • The integer int is input through .nextInt().