For your own particular class "A", the object won't do anything, and you can't use it, and it will get thrown away. But for some other different classes, this doesn't have to be the case. For example, imagine if the constructor did something a little more interesting? For example,
Given this class, using just "new A()" in your code will create a Thread which runs in the background, doing something amazing. Threads are connected to the JVM via their ThreadGroup and their native code, and so aren't garbage collected as long as they're running.
There are lots of other possibilities. The constructor could store a reference to the just-created object in a list somewhere. The class could extend JFrame, and thus be an instance of a GUI window; visible windows are "attached" to the JVM through the GUI toolkit and can't be garbage-collected. Or the constructor could itself simply do some useful work (open a file, process the data) and so after the constructor runs, the object isn't needed anymore.
So you mean to say that once the constructor is invoked and the code in it starts executing it does not matter if the object which invoked the constructor is grabge collected.
An object won't be garbage collected if any running code has a reference to it; if a method of an object is executing, that code defnitely has a reference to the object. So while that constructor is running, or while any other thread started by that object containing a reference to the object is running, or while any array or collection contains a reference to that object, the object won't be collected.
author and iconoclast