001package basics.classLoading;
002public class Main {
003        private Main() {}
004        // The following is a static initializer.
005        // It will execute the first time a class is used.
006        static { System.out.println("Main initialized"); }
007        static public void main (String[] args) {
008                System.out.print("1. ");  C.f();
009                System.out.print("2. ");  C.f();
010                System.out.print("3. ");  D.g();
011                System.out.print("4. ");  D.g();
012        }
013}
014class C {
015        private C() {}
016        static { System.out.print("C initialized; "); }
017        static void f() { System.out.println("C.f()"); }
018}
019class D {
020        private D() {}
021        static { System.out.print("D initialized; "); }
022        static void g() { System.out.println("D.g()"); }
023}