比如这样一个例子: public class test { /** * @param args */ void change(jj x){ x.x=10; } public static void main(String[] args) { // TODO Auto-generated method stub jj k=new jj(); test kk=new test(); kk.change(k); System.out.println(k.x); }} class jj{ int x=1; }
public class test { /**
* @param args
*/
void change(jj x){
x.x=10;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
jj k=new jj();
test kk=new test();
kk.change(k);
System.out.println(k.x);
}}
class jj{
int x=1;
}