why can't we declare object of a class inside the same class in C++ but it is allowed in Java?
<pre><code>class A
{
    A a;//why can't we do this in C++ but it is allowed in Java?
};
</code></pre>

<p>Using this <a href="http://stackoverflow.com/questions/4941629/why-cant-we-declare-object-of-a-class-inside-the-same-class">question</a>, i came to know why it is not allowed in C++ but why is it allowed in java? According to same argument of not knowing the memory size while compilation, it should not be allowed in Java as well.</p>
