java程序:
public class test {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
char a;
String b = null;
while(1==1) {
System.out.println("请输入一个字符:");
b = input.next();
if(b.equals("exit")) break;
a=b.charAt(0);
System.out.println("ASCII:"+(int)a);
}
}
}
效果如图所示: