使用扫描仪从控制台读取char
/* n o w j a v a . c o m - 时 代 Java */ import java.util.Scanner; public class CharacterInputOutput { public static void main(String cLA[]) { Scanner myInput = new Scanner(System.in); char myCharacter = myInput.next().charAt(0); System.out.printf("%c\n", myCharacter); System.out.println(myCharacter); } }/*时 代 J a v a - N o w J a v a . c o m 提 供*/