3 ms·
I was curious as well, so I took it for a spin[0]. In short, no. A static initializer still needs to be wrapped in a class that contains a main method. pub
by ezekg 10y ago
I was curious as well, so I took it for a spin[0]. In short, no. A static initializer still needs to be wrapped in a class that contains a main method.
public class Main {
static {
System.out.println("Hello world");
}
public static void main(String[] args) {}
}
[0]: https://repl.it/GDZG/1 https://repl.it/GDZG/1