String [] arrData = new String []{"League Of Lengends#PC","Crisis 3#PC","GTA#Xbox","Dying light#PC",
"Destiny#PS3","Skate#Xbox","Dying light#Xbox","Bloodborne#PS3","Crisis 3#Xbox",
"GTA#PS3","Age of Empires#PC","Crisis 3#PS3","Dying light#PS3","Skate#PC",
"Destiny#Xbox","Skate#PS3","GTA#PC","Counter Strike#PC","Counter Strike#Xbox"};
我可以让字符串显示
System.out.println(Arrays.toString(arrData));
Output:
[League Of Lengends#PC, Crisis 3#PC, GTA#Xbox, Dying light#PC,..., Counter Strike#Xbox]
现在我想把每场比赛都放到一个新线上
Output:
League Of Lengends#PC
Crisis 3#PC
GTA#Xbox
...
我已经尝试过但没有找到方法可以帮助我。
答案 0 :(得分:0)
您是否尝试过循环播放数组?
//loop through the array
for(int i = 0; i < arrData.length; i++){//begin for loop
//print each index on a new line
System.out.println(arrData[i]);
}//end for loop
答案 1 :(得分:0)
您可以使用foreach
循环:
for(String game : arrData ){
System.out.println(game);
}