java数组扩容

数组扩容代码如下:

String[] myStringArray = {"111","222","333"};
		myStringArray = Arrays.copyOf(myStringArray, 4);
		myStringArray[3] = "444";
		
		for(int i = 0;i

输出结果为:

mystringarray : 111
mystringarray : 222
mystringarray : 333
mystringarray : 444

 

如果要减少数组内容:

String[] myStringArray = {"111","222","333"};
		
		myStringArray = Arrays.copyOf(myStringArray, 2);
		
		for(int i = 0;i

输出为:

deleteString : 111
deleteString : 222

你可能感兴趣的:(移动开发,Android)