java的基础知识求教
public class Sales {
public static void main(String[] args){
Sales sl=new Sales();
sl.amethod();
System.out.println();
}
public void amethod(){
int i=99;
V v=new V();
v.i=30;
another(v,i);
System.out.println(v.i);
}
public void another(V v,int i){
i=0;
v.i=20;
V v2=new V();
v=v2;
System.out.println(v.i);
System.out.println(i);
}
}
public static void main(String[] args){
Sales sl=new Sales();
sl.amethod();
Sales s2=new Sales();
s2.amethod1();
}
public void amethod(){
int i=99;
V v=new V();
v.i=30;
another(v,i);
System.out.println(v);
System.out.println(v.i);
}
public void another(V v,int i){
i=0;
v.i=20;
V v2=new V();
v=v2;
System.out.println(v);
System.out.println(v2);
System.out.println(v.i);
System.out.println(i);
}
}
那么结果就是:10 0 10