数组---20161118

数组的扩容:

  ary = Arrays.copyOf( ary, ary.length + 1 );
  ary[ ary.length - 1 ] = 100;```

数组的复制:
```java  
  int[ ] ary1 = {2,4,6,8,12,1};
  int[ ] ary2 = ary1;
  System.out.println(Arrays.toString(ary2));
  int[ ] ary3 = new int[3];
  System.arraycopy(ary1, 2, ary3, 0, 3);
  System.out.println(Arrays.toString(ary3));```
![QQ图片20161118223653.png](http://upload-images.jianshu.io/upload_images/2562717-a85d6246816722b2.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

你可能感兴趣的:(数组---20161118)