On Wed, Feb 27, 2002 at 07:10:08PM +0530, Sandip Bhattacharya wrote:
| "st1" in "Method" is just a *local-variable* where a memory location is stored -
I am not sure if I still get it. Following is the Method:
private void Method(Stack st1,Stack st2) {
st2.push(new Integer(100));
st1 = st2;
On Wed, Feb 27, 2002 at 06:51:04PM +0530, Chirag Kantharia spoke out thus:
> But isn't this also st1->st2->(main:st2)?
> ie. if a -> b and b -> c shouldn't it imply a -> c (for pointers)?
It is. But only in the method "Method". That is why it is displaying
correctly inside the method only.
"st1
On Wed, Feb 27, 2002 at 04:25:07PM +0530, Sandip Bhattacharya wrote:
| In other words:
|
| Method "main":
| Local reference: st1 ,st2
|
| Method "Method":
| Before Entering:
| Local reference: st1->(main:st1)
| st2->(main:st2)
| After (st1=st2):
|
Been a long time since I had last touched Java. However I can perhaps
hazard an explanation. Forgive me if I make a mistake.
In a method, when you are sending an object reference, it is just like
a pointer(Actually a double pointer in a Java implementation).
So, the changes that you make to the
A problem in running a java Program in Linux
import java.util.Stack;
public class aClass {
public static void main(String []agrs) {
Stack st1 = new Stack();
Stack st2 = new Stack();
new aClass().Method(st1, st2);
System.out.println("st1 has: " + st1);
System.out.println("st2 has: " + s