readChar()方法从标准输入读取一个字符的类
import java.io.IOException; public class Main { public static void main(String[] args) { /* 来自 *NowJava.com - 时代Java*/ System.out.print("Enter some text and press Enter key: "); char c = readChar(); System.out.println("First character you entered is: " + c); } public static char readChar() { char c = '\u0000'; int input = 0; try { input = System.in.read(); if (input != -1) { c = (char)input; } }/**来 自 时 代 Java 公 众 号 - nowjava.com**/