Skip to content

Instantly share code, notes, and snippets.

@cgrand cgrand/Main.java
Created May 28, 2019

Embed
What would you like to do?
package doubetrouble;
import java.util.concurrent.Callable;
public class Main implements Callable<Object> {
private static class Constants {
final static Object constant;
static {
System.err.println("Lazy cosntants init");
constant = new Object();
}
}
static {
System.err.println("Main init");
}
public static void main(String[] args) {
try {
new Main().call();
} catch (Exception e) {
e.printStackTrace();
}
}
public Object call() throws Exception {
System.err.println("Main call");
return Constants.constant;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.