import java.util.Scanner;
public class Mar5th {
public static void main(String[] args) {
//1.scan이라는 이름으로 Scanner 객체를 생성하고
Scanner scan = new Scanner(System.in);
//2.scan을 이용해서 정수값을 입력 받아 변수 ans에 담는다.
int ans = scan.nextInt();
//3.ans값이 3보다 크면 2를 거짓이면 3을 x변수에 담아서
int x = (ans > 3) ? 2 : 3;
//4. x변수의 값을 출력한다.
System.out.println(x);
}
}
Scanner scan = new Scanner(System.in);
Scanner : 개체
scan : Scanner의 객체
new : 객체생성
System.in : 콘솔입력값을 받음.
int ans = scan.nextInt();
scan.nextInt() : 객체 scan을 이용해 nextInt()메소드를 호출한다. 정수값을 받는 메소드.