프로그래밍/Java

[Java] 문자 입력 받기

YuminK 2022. 4. 1. 18:50
import java.io.IOException;

class Exam {

	public static void main(String[] args) throws IOException {
				
		int Input1 = System.in.read();
		int Input2 = System.in.read();
		int Input3 = System.in.read();
		int Input4 = System.in.read();
		int Input5 = System.in.read();
		
		System.out.println("Input1 : " + Input1);
		System.out.println("Input2 : " + Input2);
		System.out.println("Input3 : " + Input3);
		System.out.println("Input4 : " + Input4);
		System.out.println("Input5 : " + Input5);
	
	}
}
ABC
Input1 : 65
Input2 : 66
Input3 : 67
Input4 : 13
Input5 : 10

Enter Key = \r\n

\r = ASCII 13

\n = ASCII 10