static initialization in interface
Interfaces should not have side-effects and that even applies to static intializers. They would have highly JVM-implementation dependent behavior. Look at the following code public class InterfaceSideEffects { public static void main(String[] args) { System.out.println(“InterfaceSideEffects.main()”); Impl i=new Impl(); System.out.println(“Impl initialized”); i.bla(); System.out.println(“Impl instance method invoked”); Foo f=new Impl(); System.out.println(“Impl initialized and assigned to Foo”); f.bla(); … Read more