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: " + st2);
}
private void Method(Stack st1,Stack st2) {
st2.push(new Integer(100));
st1 = st2;
System.out.println("st1 has: "+st1);
System.out.println("st2 has: "+st2);
}
}
1
The output of the program is strange , what could be the problem.
It gives output as
st1 has: [100]
st2 has: [100]
st1 has: []
st2 has: [100]
Can someone tell me why this output comes , why is st1 equal to [100] inside
and [] outside.
From
mOhit kHullar
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
================================================
To subscribe, send email to [EMAIL PROTECTED] with subscribe in subject header
To unsubscribe, send email to [EMAIL PROTECTED] with unsubscribe in subject header
Archives are available at http://www.mail-archive.com/ilugd%40wpaa.org
=================================================