+ 2
why is the static block executed before the main method in java?
for instance: class A{ static{ //👈 system.out.print(1); } public static void main(String[] args){ sytem.out.print(2); } } //output is 12
2 odpowiedzi
for instance: class A{ static{ //👈 system.out.print(1); } public static void main(String[] args){ sytem.out.print(2); } } //output is 12