package gc;
public class Swap
{
int i=10;
String s="hello";
String t="world";
public static void swap(Swap integer)
{
String temp = integer.s;
integer.s=integer.t;
integer.t=temp;
}
public static void main(String[] args){
Swap integer=new Swap();
swap(integer);
add(integer);
System.out.println(integer.i);
System.out.println(integer.s+"=="+integer.t);
}
public static void add(Swap integer)
{
//MInteger integer1=new MInteger();
integer.i=0;;
}
}
Thursday, December 20, 2007
Pass by value in java not by reference
Posted by Prem Kumar Jha at 1:02:00 PM
Labels: JAVA
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment