i am using Static block without using main method in java version "18.0.2" 2022-07-19 the code is perfectly working without any compile error and runtime error how is this possible?
class StaticBlockPrint{
static {
System.out.println("Hello world!");
int i = 8;
i =i+8;
System.out.println(i);
System.exit(0);
}
}