java报错:进行语法分析时已到达文件结尾
问题描述:
class StaticSuper{
static {
System,out.println("super static block");
}
StaticSuper(){
System.out.println("super constructor");
}
}
public class StaticTests extends StaticSuper{
static int rand;
static {
rand = (int) (Math.random()*6);
System.out.println("Static block "+rand);
}
StaticTests(){ //就这里一直提示:进行语法分析时已到达文件结尾 下面有个} 标记 但是我查了好几遍,重写了好几遍,拢共就这么几个括号没问题啊!
System.out.println("constructor");
}
public static void main (String [] args){
System.out.println("in main");
StaticTests st = new StaticTests();
}
}
要怎么改啊,目前还没学到异常检测
答
哈哈哈哈嗝儿~~~~~~父类少了一个括号,我编译子类的时候没检查父类,见笑了~