6.7-3将数组arr中索引值为2的元素替换为“bb”
package shuzu; import java.util.Arrays; public class TH { public static void main(String[] args) { // TODO Auto-generated method stub String arr[] = {"qq","ww","ee"}; for(String x : arr) { System.out.println("替换前数组arr中元素有:"+x); } Arrays.fill(arr,2,3,"bb"); for(String x : arr) { System.out.println("替换前数组arr中元素有:"+x); } } }