Hi, i have written this program:
import java.util.Stack;
public class aClass
{
static final int i = 10;
public static void main(
String []agrs)
{
Stack st1 = new Stack();
Stack st2 = new Stack();
aClass c = new aClass();
new aClass().Method(st1, st2);
System.out.println("st1 has: " + st1);
System.out.println("st2 has: " + st2);
System.out.println(i);
System.out.println(c.i);
}
private void Method(Stack st1,Stack st2)
{
System.out.println("st1 has: " + st1);
System.out.println("st2 has: " + st2);
st2.push(new Integer(100));
st1 = st2;
System.out.println("st1 has: " + st1);
System.out.println("st2 has: " + st2);
System.out.println(i);
}
}
But i am getting the o/p of str1 as 'blank'in the public static void main (String[] args) method.
Since i have assigned the str1 = str2 ,so i am supposing that str1 =100 also.
Please tell me the reason, why i am getting the value of str1 as blank.
Its very urgent .Please provide me the solution...if anybody can......
[ November 06, 2007: Message edited by: hamraj happy ]