【发布时间】:2010-12-09 07:00:58
【问题描述】:
嘿,我正在寻找一个接收这个数组的循环:
String[] arr = new String[3];
arr[0] = "one ";
arr[1] = "two ";
arr[2] = "three ";
然后输出:
one two three one one two two three three one one one two two two three three three
基本上,我希望它在每次迭代时将每个数组值的显示次数增加一。
【问题讨论】:
-
这听起来像是一道作业题...尝试使用 Math.floor
-
我认为你的意思是“new String[3];”
-
你是如何实现它的?我的意思是你一定试过了。对吗?
-
想想如果将一个 for 循环放入另一个循环会发生什么。
-
@Adeel Ansari 我很糟糕,后来我进入了线程 ^^ 可惜有人已经给出了答案,而不是 Ian 没有想到如何得到答案,并且会卡在他的下一个循环中写