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 }

 

相关文章:

  • 2021-04-12
  • 2021-08-25
  • 2022-01-15
  • 2021-12-14
  • 2021-11-30
  • 2021-09-10
  • 2021-05-24
  • 2022-12-23
猜你喜欢
  • 2021-10-15
  • 2021-09-17
  • 2022-01-18
  • 2021-06-17
  • 2021-09-20
  • 2021-12-10
  • 2021-07-26
相关资源
相似解决方案