import java.io.*;
public class SimpleCharInOut{
char c;
System.out.print ("Enter a character please:");
try{
c=(char)System.in.read();
}
catch(IOException e){
System.err.println(e.toString());
}
System.out.println("You have entered character"+c);
}
}
这段代码编译的时候,系统报有5个错误,麻烦高手看一下都哪里出错了好么,谢谢!~
參考答案:package com.news;
import java.util.StringTokenizer;
import java.io.*;
public class A{
public void mian(){
char c='a';
System.out.print ("Enter a character please:");
try{
c=(char)System.in.read();
}
catch(IOException e){
System.err.println(e.toString());
}
System.out.println("You have entered character"+c);
}
}
你的表达式应该放在一个方法里面
而且你多了一个}
c应该有初始值