Switch statement in Java displays weird output after removing "break;"
<p>I'have created this code but the output of it is weird.. Maybe cause I'm new at Java. I expect from this code the output <code>2 1 0</code> but when I remove the <code>break</code> statement after all the <code>case</code> statements this weird output displays: <code>2 1 2 0 1 2</code></p>

<p>Can someone please explain why this happens? This is my code:</p>

<pre><code>public class Sem2 {
    final static short x = 2;

    public static void main(String [] args) {
        for (int z=0; z &lt; 3; z++) 
        {
            switch (z) 
            {
                case x: System.out.print("0 ");
                case x-1: System.out.print("1 ");
                case x-2: System.out.print("2 ");
            } 
        }
    }
}
</code></pre>