JAVA关于参数方法的问题
import *;public class MyMethod {
int num;
public static void main(String args[])
{
int num;
num=10;
System.out.println("original num is:"+num);
MyMethod mymth=new MyMethod();
mymth.print();
System.out.println("num after change is:"+num);
}
public void print()
{
System.out.println("num class is:"+num);
num=90;
System.out.println("num of change is:"+num);
}
}输出的结果是
original num is:10
num class is:0
num of change is:90
num after change is:10
想问下MyMethod mymth=new MyMethod();
mymth.print();的作用的和意思,怎么num after change is的值还是10呢?