Skip to content

Instantly share code, notes, and snippets.

@wilkinsona
Last active April 29, 2020 06:30
Show Gist options
  • Save wilkinsona/8c4b556d88681e18d3d80d39db6ad786 to your computer and use it in GitHub Desktop.
Save wilkinsona/8c4b556d88681e18d3d80d39db6ad786 to your computer and use it in GitHub Desktop.
import java.util.Arrays;
import java.util.List;
public class FunWithStaticInitialization {
public static void main(String[] args) {
new SimpleThing();
}
interface Thing {
Thing DEFAULT = new SimpleThing();
default void method() {
}
}
static class SimpleThing implements Thing {
private static List<String> items = Arrays.asList("alpha", "bravo");
SimpleThing() {
System.out.println(items.size());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment