都说char类型的字符转int会自动转换,那么转换成什么呢,我们举个例子:
int b ='z';
System.out.println(b);
很明显‘z’是一个char类型的,输出的时候会自动转为十进制,那么值为多少呢,运行后可以知道值为122,那么122那里来的呢,其实就只在ASCII码表里面对应的啦。
ASCII码表 0-127
Bin | Dec | Hex | 缩写/字符 | 解释 |
---|---|---|---|---|
0 | 0 | 0 | NUL(null) | 空字符 |
1 | 1 | 1 | SOH(start of headling) | 标题开始 |
10 | 2 | 2 | STX (start of text) | 正文开始 |
11 | 3 | 3 | ETX (end of text) | 正文结束 |
100 | 4 | 4 | EOT (end of transmission) | 传输结束 |
101 | 5 | 5 | ENQ (enquiry) | 请求 |
110 | 6 | 6 | ACK (acknowledge) | 收到通知 |
111 | 7 | 7 | BEL (bell) | 响铃 |
1000 | 8 | 8 | BS (backspace) | 退格 |
1001 | 9 | 9 | HT (horizontal tab) | 水平制表符 |
1010 | 10 | 0A | LF (NL line feed, new line) | 换行键 |
1011 | 11 | 0B | VT (vertical tab) | 垂直制表符 |
1100 | 12 | 0C | FF (NP form feed, new page) | 换页键 |
1101 | 13 | 0D | CR (carriage return) | 回车键 |
1110 | 14 | 0E | SO (shift out) | 不用切换 |
1111 | 15 | 0F | SI (shift in) | 启用切换 |
10000 | 16 | 10 | DLE (data link escape) | 数据链路转义 |
10001 | 17 | 11 | DC1 (device control 1) | 设备控制1 |
10010 | 18 | 12 | DC2 (device control 2) | 设备控制2 |
10011 | 19 | 13 | DC3 (device control 3) | 设备控制3 |
10100 | 20 | 14 | DC4 (device control 4) | 设备控制4 |
10101 | 21 | 15 | NAK (negative acknowledge) | 拒绝接收 |
10110 | 22 | 16 | SYN (synchronous idle) | 同步空闲 |
10111 | 23 | 17 | ETB (end of trans. block) | 传输块结束 |
11000 | 24 | 18 | CAN (cancel) | 取消 |
11001 | 25 | 19 | EM (end of medium) | 介质中断 |
11010 | 26 | 1A | SUB (substitute) | 替补 |
11011 | 27 | 1B | ESC (escape) | 溢出 |
11100 | 28 | 1C | FS (file separator) | 文件分割符 |
11101 | 29 | 1D | GS (group separator) | 分组符 |
11110 | 30 | 1E | RS (record separator) | 记录分离符 |
11111 | 31 | 1F | US (unit separator) | 单元分隔符 |
100000 | 32 | 20 | (space) | 空格 |
100001 | 33 | 21 | ! | |
100010 | 34 | 22 | “ | |
100011 | 35 | 23 | # | |
100100 | 36 | 24 | $ | |
100101 | 37 | 25 | % | |
100110 | 38 | 26 | & | |
100111 | 39 | 27 | ‘ | |
101000 | 40 | 28 | ( | |
101001 | 41 | 29 | ) | |
101010 | 42 | 2A | * | |
101011 | 43 | 2B | + | |
101100 | 44 | 2C | , | |
101101 | 45 | 2D | - | |
101110 | 46 | 2E | . | |
101111 | 47 | 2F | / | |
110000 | 48 | 30 | 0 | |
110001 | 49 | 31 | 1 | |
110010 | 50 | 32 | 2 | |
110011 | 51 | 33 | 3 | |
110100 | 52 | 34 | 4 | |
110101 | 53 | 35 | 5 | |
110110 | 54 | 36 | 6 | |
110111 | 55 | 37 | 7 | |
111000 | 56 | 38 | 8 | |
111001 | 57 | 39 | 9 | |
111010 | 58 | 3A | : | |
111011 | 59 | 3B | ; | |
111100 | 60 | 3C | < | |
111101 | 61 | 3D | = | |
111110 | 62 | 3E | > | |
111111 | 63 | 3F | ? | |
1000000 | 64 | 40 | @ | |
1000001 | 65 | 41 | A | |
1000010 | 66 | 42 | B | |
1000011 | 67 | 43 | C | |
1000100 | 68 | 44 | D | |
1000101 | 69 | 45 | E | |
1000110 | 70 | 46 | F | |
1000111 | 71 | 47 | G | |
1001000 | 72 | 48 | H | |
1001001 | 73 | 49 | I | |
1001010 | 74 | 4A | J | |
1001011 | 75 | 4B | K | |
1001100 | 76 | 4C | L | |
1001101 | 77 | 4D | M | |
1001110 | 78 | 4E | N | |
1001111 | 79 | 4F | O | |
1010000 | 80 | 50 | P | |
1010001 | 81 | 51 | Q | |
1010010 | 82 | 52 | R | |
1010011 | 83 | 53 | S | |
1010100 | 84 | 54 | T | |
1010101 | 85 | 55 | U | |
1010110 | 86 | 56 | V | |
1010111 | 87 | 57 | W | |
1011000 | 88 | 58 | X | |
1011001 | 89 | 59 | Y | |
1011010 | 90 | 5A | Z | |
1011011 | 91 | 5B | [ | |
1011100 | 92 | 5C | \ | |
1011101 | 93 | 5D | ] | |
1011110 | 94 | 5E | ^ | |
1011111 | 95 | 5F | _ | |
1100000 | 96 | 60 | ` | |
1100001 | 97 | 61 | a | |
1100010 | 98 | 62 | b | |
1100011 | 99 | 63 | c | |
1100100 | 100 | 64 | d | |
1100101 | 101 | 65 | e | |
1100110 | 102 | 66 | f | |
1100111 | 103 | 67 | g | |
1101000 | 104 | 68 | h | |
1101001 | 105 | 69 | i | |
1101010 | 106 | 6A | j | |
1101011 | 107 | 6B | k | |
1101100 | 108 | 6C | l | |
1101101 | 109 | 6D | m | |
1101110 | 110 | 6E | n | |
1101111 | 111 | 6F | o | |
1110000 | 112 | 70 | p | |
1110001 | 113 | 71 | q | |
1110010 | 114 | 72 | r | |
1110011 | 115 | 73 | s | |
1110100 | 116 | 74 | t | |
1110101 | 117 | 75 | u | |
1110110 | 118 | 76 | v | |
1110111 | 119 | 77 | w | |
1111000 | 120 | 78 | x | |
1111001 | 121 | 79 | y | |
1111010 | 122 | 7A | z | |
1111011 | 123 | 7B | { | |
1111100 | 124 | 7C | I | |
1111101 | 125 | 7D | } | |
1111110 | 126 | 7E | ~ | |
1111111 | 127 | 7F | DEL (delete) | 删除 |