Linux教程網
JAVA數組的替換
- import java.util.Arrays;
- /**
- * 數組的替換
- * @author HAN
- *
- */
- public class ArrayFillApps {
-
- public static void main(String[] args) {
- String arr1[]=new String[]{"2","4","4","6","77"};
- for(String x:arr1){
- System.out.print(x+" ");
- }
-
- Arrays.fill(arr1,2,3,"bb");
- System.out.println();
- for(String x:arr1){
- System.out.print(x+" ");
- }
-
- }
-
- }
Copyright ©
Linux教程網 All Rights Reserved