public static void main(String[] args){ Temp temp = new Temp(); int ab=0; temp.te1(ab); System.out.print(ab); } 楼主要看基础书了:)
int类型参数是传值操作 public class test{ static int ab; public static void main(String[] args){ test temp = new test(); ab=0; temp.te1(); System.out.print(ab); }
Temp temp = new Temp();
int ab=0;
temp.te1(ab);
System.out.print(ab);
}
楼主要看基础书了:)
public class test{
static int ab;
public static void main(String[] args){
test temp = new test();
ab=0;
temp.te1();
System.out.print(ab);
}
private void te1(){
ab++;
}
}