Counter.java


public class Counter {
    
    private static Counter2 counter2;
    
    static {        
        System.out.println("in static initializer of Counter!");
        counter2 = new Counter2(); 
    }
    
    public static void main(String[] args) {
        System.out.println("testing");
        Counter counter = new Counter();
        Integer result = counter.addOne(2);
        System.out.println("addOne called with 2 = " + result);
    }
    
    public Integer addOne(Integer input) {
        System.out.println("in Counter.addOne");
        return ++input;
    }
    
    public Integer addTwo(Integer input) {
        return input + 2;
    }
}