import java.util.*;
public class Test {
public static void main(String []args) {
ArrayList arrlist = new ArrayList(); String str1 = "Think before you act.\n";
String str2 = "full of courtesy,full of craft.\n";
String str3 = "Best is cheapest.\n";
String str4 = "Look before you leap.\n";
String str5 = "take time when time comes.\n";
arrlist.add(str1);
arrlist.add(str2);
arrlist.add(str3);
arrlist.add(str4);
arrlist.add(str5);
System.out.println("输出集合内容");
for(int i=0;i<=arrlist.size();i++)
System.out.print(arrlist.get(i)+"\n");
}
}
public class Test {
public static void main(String []args) {
ArrayList arrlist = new ArrayList(); String str1 = "Think before you act.\n";
String str2 = "full of courtesy,full of craft.\n";
String str3 = "Best is cheapest.\n";
String str4 = "Look before you leap.\n";
String str5 = "take time when time comes.\n";
arrlist.add(str1);
arrlist.add(str2);
arrlist.add(str3);
arrlist.add(str4);
arrlist.add(str5);
System.out.println("输出集合内容");
for(int i=0;i<=arrlist.size();i++)
System.out.print(arrlist.get(i)+"\n");
}
}
System.out.println(s);
}这样写好。
System.out.print(arrlist.get(i)+"\n");
}多了一个=号