What will happen if you try to compile and run this ? public class Test{ static{ print(10); } static void print(int x){ System.out.println(x); System.exit(0); } }
. Compiler error.
Will throw a NoSuchMethod error at runtime.
It will compile and run printing out "10"
It will run with no output.