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 + "\nits unicode number is: " + num); } }
Java读取char数据: System.in.read()
猜你喜欢
转载自www.cnblogs.com/profesor/p/12908758.html
今日推荐
周排行