Skip to content

06.文字とコード

domanthan edited this page Jun 22, 2020 · 1 revision
/**
 *
 */
package lesson03;

/**
 * @author gridscale
 *
 */
public class Code {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		int c = 'A';

		// ASCII Code of 'A' is ?

		System.out.println("Code of A is " + c);

		// ASCII Code Table : 0 ---> 255
		// ASCII Code of A is : 65

		c = 0;

		for (c = 0; c < 256; c++) {
			System.out.println("Ascii code of " + (char)c + " is:" + c);
		}
        // 9 -> TAB KEY, UNICODE -》 SJIS,EUC

		c = 'あ';

		for (c = '人'; c <= '皮' ; c ++) {
			System.out.println("Code of " + (char)c + " is :" + c);
		}

		String s = "アイウエオ、かきくけこ";

		for (int i = 0; i < s.length(); i++) {
			System.out.println("Number " + i + " char of s is " + s.charAt(i) + " Code is:" + (int)s.charAt(i));
		}
	}
}

Clone this wiki locally