Possible Duplicate:
Java, pass-by-value, reference variables
Consider the following simple java program
class main{
public static void main(String args[]){
int x = 5;
change(x);
System.out.println(x);
}
static void change(int x){
x = 4;
}
}
Since java uses pass by value the value of x will not change in the main..To overcome this problem we have the concept of pass by reference in c..But i do not find any such concept in java..How can i really change the value of x..? If there is no way of changing x then is this not a disadvantage of java?