Vote count:
0
class a
{
static final int a =5;
static {
System.out.println("hi");
}
}
class b
{
public static void main(String[] args) {
System.out.println(a.a);
}
}
why do on writing final keyword ,the static block doesn't run,and the out put comes to be 5,whereas if I remove final keyword ,the output comes hi 5
asked 14 secs ago
Aucun commentaire:
Enregistrer un commentaire