如果想把foreach语句改成for语句,请问该怎么操作?

int[]arr=new int[]{8,2,1,0,3};
int[] index=new int[]{2,0,3,2,4,0,1,3,2,3,3};
String tel="";
for(int i:index){
tel+=arr[i];
}

至尊宝的传说
浏览 299回答 2
2回答

守着星空守着你

double mapScale;for(int i = 0; i < MOHelper.getInstance().GetLayerConfigs().Count; i++){mapScale += lc.MapScale;}------解决方案--------------------double mapScale;for(int i= 0 ; i < MOHelper.getInstance().GetLayerConfigs().count ; i++){mapScale = MOHelper.getInstance().GetLayerConfigs()[i].MapScale;}

神不在的星期二

//使用for遍历数组for&nbsp;(int&nbsp;i&nbsp;=&nbsp;0;&nbsp;i&nbsp;<&nbsp;index.length;&nbsp;i++)&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;System.out.println("第"+i+"元素是:"+index[i]);}
打开App,查看更多内容
随时随地看视频慕课网APP