public class getchar { public static void main(String[] args) throws java.io.IOException //必不可少 { int num = System.in.read(); //读进来的数,默认保存为整数,如果需要输出 刚才输入字符,需要用char进行强制转换(type cast) char c = (char) num; System.out.println("the char you've just input is: " + c + " its unicode number is: " + num); } }