日期:2014-05-20  浏览次数:20740 次

求助 莫名奇妙的错误
        public static final int START_X = 200;
public static final int START_Y = 200; //这里提示:Multiple markers at this line- Syntax error on token ";", { expected after this  token

try{
    FileReader in = new FileReader("D:\test.txt");
 }catch(FileNotFoundException e){
e.printStackTrace();
 }

错误是加了try~catch后出现的 括号检查过了 没问题啊

------解决方案--------------------
养成一个好的习惯,建议使用FileReader(File file) 此构造方法,路径就会提示错误了~
------解决方案--------------------
引用:
"D:\\test.txt"
或者:
"D:/test.txt"

这是运行时才会提示的错误,撸主在编译期就过不了

撸主把try-catch放到static{}中
------解决方案--------------------
引用:
Quote: 引用:

"D:\\test.txt"
或者:
"D:/test.txt"

这是运行时才会提示的错误,撸主在编译期就过不了

撸主把try-catch放到static{}中


哦  难道说楼主没把try catch放在方法里面? 或者没用静态块?