-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCopy.java
More file actions
19 lines (17 loc) · 436 Bytes
/
Copy.java
File metadata and controls
19 lines (17 loc) · 436 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package java03;
import java.util.Arrays;
public class Copy {
public static void main(String[] args) {
int arr[] = new int[]{11,21,13,43,15};
System.out.println("原来是");
for(int i=0;i<arr.length;i++){
System.out.print(arr[i]+"\t");
}
System.out.print("\n");
int arrnew[] = Arrays.copyOf(arr,3);
System.out.println("现在是");
for(int i=0;i<arrnew.length;i++){
System.out.print(arrnew[i]+"\t");
}
}
}