java当中也有pass-by-value值传递或pass-by-reference地址传递吗

About Method’s arguments(参数)

In java, each of the method'sargument are passed(传递) tothat method via(通过)pass-by-value(值传递)orpass-by-reference.(地址传递),这一点和c语言是一样的,


public class Test22{

public static void modify(int k){
      k = k*k;
}

public static void modify(int[] x){
     for(int i=0; i< x.length; i++){
           x[i] = x[i]*x[i];
     }
}
public static void main(String[] args){
     int i = 100;
     int[] iArray = {1,2,3};
。。。。。。由于篇幅限制,更多详情请见: http://www.mark-to-win.com/JavaBeginner/JavaBeginner1_web.html#pass-by-value
阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭