java如何让数组里的字符串循环输出
packageItniwo;publicclassfors{publicstaticvoidmain(String[]args){String[]strings={"你好...
package Itniwo;
public class fors {
public static void main(String[] args) {
String[] strings = {"你好", "哈哈", "江山", "美人"};
}
}
每输出一个中间阁5秒的时间 展开
public class fors {
public static void main(String[] args) {
String[] strings = {"你好", "哈哈", "江山", "美人"};
}
}
每输出一个中间阁5秒的时间 展开
6个回答
展开全部
String[] strings = {"你好", "哈哈", "江山", "美人"};
for(String str:strings){
System.out.println(str);
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
for(String str:strings){
System.out.println(str);
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
public class fors {
public static void main(String[] args) {
String[] strings = {"你好", "哈哈", "江山", "美人"};
for(String string : strings){
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.print(string);
}
}
}
public static void main(String[] args) {
String[] strings = {"你好", "哈哈", "江山", "美人"};
for(String string : strings){
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.print(string);
}
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
public class TestCirculation {
public static void main(String[] args) {
String[] string = { "你好", "哈哈", "江山", "美人" };
for (int i = 0; i < string.length; i++) {
System.out.println(string[i]);
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
public static void main(String[] args) {
String[] string = { "你好", "哈哈", "江山", "美人" };
for (int i = 0; i < string.length; i++) {
System.out.println(string[i]);
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
int[] i = 自己定义的数组;
for(int i=0;true;i++){
System.out.println(i[i%i.length]);
}
for(int i=0;true;i++){
System.out.println(i[i%i.length]);
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询