Java initializing a pure struct
<p>Here is what I'm trying to do:</p>

<pre><code>public class myClass
{
  int x;
  int y;
}
</code></pre>

<p>I have learned c++, so I tried to do this:</p>

<pre><code>myClass [] a  = new myClass[5];
for(int i =0; i &lt; 4; i++)
    a[i].x = 0;
</code></pre>

<p>This doesnt do anything, because all a[i] are null.</p>

<p>I know this is against the basic principal of Java, but there is a product called Alljoyn, which force me to do this, see:</p>

<p><a href="https://www.alljoyn.org/docs-and-downloads/documentation/guide-alljoyn-development-using-java-sdk-rev-j#unique_28" rel="nofollow">https://www.alljoyn.org/docs-and-downloads/documentation/guide-alljoyn-development-using-java-sdk-rev-j#unique_28</a></p>

<p>AllJoyn doesnt allow constructor or other methods in the class. Is there any other way to initialize a pure struct?</p>
