实践与练习6.7-1

 1 package shuzu;
 2 
 3 import java.util.Arrays;
 4 
 5 public class SZ {
 6 
 7     public static void main(String[] args) {
 8         // TODO Auto-generated method stub
 9 
10         int arr1[] = {1,2,3,4,5};
11         int arr2[];
12         arr2 = Arrays.copyOf(arr1, 4);
13         for(int x : arr1)
14         {
15             System.out.println("数组arr1中元素有:"+x);
16         }
17         for(int x : arr2)
18         {
19             System.out.println("数组arr2中元素有:"+x);
20         }
21     }
22 
23 }

 

posted @ 2015-10-10 08:38  dirgo  阅读(132)  评论(0编辑  收藏  举报