JAVA数组的替换


JAVA数组的替换

  1. import java.util.Arrays;  
  2. /** 
  3.  * 数组的替换 
  4.  * @author HAN 
  5.  * 
  6.  */  
  7. public class ArrayFillApps {  
  8.   
  9.     public static void main(String[] args) {  
  10.         String arr1[]=new String[]{"2","4","4","6","77"};  
  11.         for(String x:arr1){  
  12.             System.out.print(x+" ");  
  13.         }  
  14.           
  15.         Arrays.fill(arr1,2,3,"bb");  
  16.         System.out.println();  
  17.         for(String x:arr1){  
  18.             System.out.print(x+" ");  
  19.         }  
  20.           
  21.     }  
  22.   
  23. }  

相关内容