Hi,
I am learning JAVA. Basically I am from C++ environment. I have some doubts on JAVA Programming.


1. How the Memory Management is done in JAVA. I am not clear on that.

Consider the Piece of Code

public Object pop()
{
return Storage[index--];
}

If the Value of "index" is 2, the 3rd Object is returned but it will not be eligible for Garbage Collection. We need to write the Statement "Storage[index] = null" to make it free. Then how is the Garbage Collection is powerful. I am not clear on this.

2. Where to write the "main" function if we have more than one class (for example in a Subsystem)

3. How does the Object reference work?. How the contents of Object only gets changed when passed as an argument to a method and not other data types.

4. What is the idea behind the "Transient" variables.

Please clarify my doubts. Appreciate immediate reply.

Thanks in Advance,
Kalyan