Java-SCJP question
<p>Consider:</p>

<pre><code>class Building {
    Building() {
        System.out.print("b ");
    }
    Building(String name) {
        this();
        System.out.print("bn "+name);
    }
}
public class House extends Building {
    House() {
        System.out.print("h ");
    }
    House(String name) {
        this();
        System.out.print("hn "+name);
    }
    public static void main(String a[]) {
        new House("x ");
    }
}
</code></pre>

<p>For the above program, I thought the output must be h hn x. But the output comes  as b h hn x.</p>

<p>Why?</p>

<p>Later</p>

<pre><code>public class TestDays {

    public enum Days {
        MON,TUE,WED
    };
    public static void main(String []args) {

        for(Days d : Days.values())
        ;
        Days [] d2=Days.values();
        System.out.println(d2[2]);

    }

}
</code></pre>

<p>I can't understand the above program. Please help me.</p>

<pre><code>class Mammal {

    String name="furry";
    String makeNoise() {
        return "generic noise";
    }

}

class Zebra extends Mammal {

    String name="stripes";
    String makeNoise() {
        return "bray";
    }

}
public class ZooKeeper {

    public static void main(String args[]) {
        new ZooKeeper().go();
    }
    void go() {

        Mammal m=new Zebra();
        System.out.println(m.name+m.makeNoise());

    }

}
</code></pre>

<p>In the above program, makeNoise() is overridden. And so output must be stripes bray. But the output is furry bray.</p>
