Java

<Java > ASCII

98kg 2023. 11. 1. 15:01

이번 포스팅은 ASCII 코드에 대해 해보겠습니다.


 

아스키 코드 (ANSI) : 미국 표준 코드 

코드로 간단히 테스트 해보자

        char c = 'A'; // 알파벳 대문자는 65부터 , 소문자는 97, 숫자는 48 시작.
        System.out.println(c);
        System.out.println((int)c);

        c = 'B';
        System.out.println(c);
        System.out.println((int)c);

        c++;
        System.out.println(c);
        System.out.println((int)c);

        String[][]seats3 = new String[10][15];
        char ch = 'A';

        for (int i = 0; i < seats3.length; i++) {
            for (int j = 0; j < seats3[i].length; j++) {
                seats3[i][j] = String.valueOf(ch) + (j + 1);
            }
            ch++;
        }
        for (int i = 0; i < seats3.length ; i++) { //i < 세로크기
            for (int j = 0; j < seats3[i].length; j++) { //j < 가로크기
                System.out.print(seats3[i][j] + " ");
            }
            System.out.println();
        }

실행결과