Why do I get this compile error in Java?
<p>In java why is the following code not allowed by the compiler?</p>

<pre><code>public class Test {

    public static void main(String[] args) {

        int x;
        int x = 4;// the error is generated here

    }

}
</code></pre>
