Thanks for your reply Richa!
However,
Java allows such memory assignments at class level (in fact I got one such example in the book '
Head First Java' page #239). So, in case you create (and assign) an object to a different class than X (at the class level), it works!
The problem here is: The constructor called is of the same class as the one in which the code exists in the first place. So there is a kind of recursive call!
However, it is the same with both the Versions (i.e. both are kind of recursive calls). But, only one goes for the stack overflow. Not sure why...