Java数组扩容操作会改变地址的验证

import java.util.Arrays;

public class ArrayUseDemo

{

  public static void main(String []args)

  {

    int [] arr = {1,2,3,4,5,6};

    System.out.println(arr);

    System.out.println(Arrays.toString(arr));

    arr = Arrays.copyOf(arr,2);

    System.out.println(arr);

    System.out.println(Arrays.toString(arr));

  }

}

 

    

    

posted @ 2018-01-05 20:03  songyao  阅读(632)  评论(0编辑  收藏  举报