【发布时间】:2014-09-27 17:14:33
【问题描述】:
这是我的代码:
public class MyTestClass {
public static void main(String[] args) throws Exception {
Scanner scanner = new Scanner(System.in);
String s = scanner.nextLine();
InputStream inputStream = System.in;
int read = inputStream.read();
System.out.println(read);
System.out.println((char)read);
System.out.println(s);
}
}
我在运行程序时输入了两次字母ğ。控制台输出将是:
ğ
ğ
196
Ä
ğ
我如何才能看到正确的字母而不是 Ä?扫描仪似乎做对了。
实际上,为什么这种方法不起作用?这里有什么问题?
【问题讨论】: