[code]public class staticSuper {
static{
System.out.println("Super static Block");
}
staticSuper(){
System.out.println(“Super contructor”);
}
}
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();
}
}[/code]
Esse código não dá certo, o Eclipse dá a seguinte mensagem: [color=red]The public type StaticTests must be defined in its own file[/color].
no: public class StaticTests extends staticSuper{
static int rand;
O que será? por que não compila?