首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

莫名奇妙的异常

2013-07-16 
求助 莫名奇妙的错误public static final int START_X 200public static final int START_Y 200 //

求助 莫名奇妙的错误
        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放在方法里面? 或者没用静态块?

热点排行