数组扩容测试

public class Test2 {
public static void main(String[] args) {
int [] its = {1,2,3};
int [] it2 = {4,5,6};
its = Arrays.copyOf(its, its.length+it2.length); //该操作只是将原来数组容量变大了,并没有进行复制
                             //复制的话,只能使用System.arrayCopy()进行
System.out.println(its.length); } }

  

转载于:https://www.cnblogs.com/m5w10/p/3652311.html

你可能感兴趣的:(数组扩容测试)