增长java中数组的长度


package month_201711;

import java.util.Arrays;
/**
* 数组长度+1
* @author watchfree
*
*/
public class Main27_1 {

public static void main(String[] args) {
// TODO Auto-generated method stub
int [] a = new int[]{1,2,3,4,5,6,7,8,9} ;
a = Arrays.copyOf(a, a.length+1) ;
for (int temp : a) {
System.out.print(temp+" ") ;
}
}

}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM