题解 | #字符转ASCII码#
字符转ASCII码
http://www.nowcoder.com/practice/93f4d05a02d9468db424ed4316bfc8fd
import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String str = in.nextLine();
char cr = str.charAt(0);//提取输入str中的第一个元素,也就是输入字符
int assci = (int) cr;//将字符转化为对应的ASCII码
System.out.println(assci);
}
}