Can't understand error about Object array
<p>TestAddress.java</p>

<pre><code>Address[] adrsarr = new Address[5];
        adrsarr[0] = new Address("B402", "3", "42", "Behind Sector 9",
                "New Delhi", "Delhi", "Delhi", "India", "232113");
        adrsarr[1] = new Address("B1", "2", "61", "Bb Road 2", "Mumbai",
                "Mumbai", "Maharashtra", "India", "1213");
        adrsarr[2] = new Address("AH2", "325", "98", "BPGC", "Goa", "Goa",
                "Goa", "India", "403726");
        adrsarr[3] = new Address("a222", "2", "81", "Sector market",
                "New Delhi", "Delhi", "Delhi", "India", "11a001");
</code></pre>

<p>Address.java has a constructor of type <code>Address()</code> and of <code>Address(string, string, string, string, string, string, string, string, string)</code></p>

<p>Now this given code does not work inside the main TestAddress class, it gives an error on the line where I'm declaring adrsarr</p>

<pre><code>- Syntax error on token ";", { expected after this token
</code></pre>

<p>But if I put it inside a function like buildArr(), then it compiles flawlessly, no errors.</p>

<p>Any idea what's happening? How am I supposed to initialize an object array without making a function?</p>
