java字符与ASCII码互转字符转对应ASCII码// ⽅法⼀:将char强制转换为bytechar ch = 'A';记住我byte byteAscii = (byte) ch;System.out.println(byteAscii);// ⽅法⼆:将char直接转化为int,其值就是字符的asciiint byteAscii1 = (int) ch;System.out.println(byteAscii1);ASCII码转字符// 直接int强制转换为charint ascii = 65;char ch1 = (char)ascii;System.out.println(ch1);
发布评论