我有一个充满不同变量的数组列表。如何使用printfJava 中的标志将此数组列表打印到控制台?
public class mendietaRAL {
public static void theArrayList() {
ArrayList<Object> theList = new ArrayList<Object>();
theList.add(123);
theList.add("Java");
theList.add(3.75);
theList.add("Summer C");
theList.add(2018);
for (int i = 0; i < theList.size(); i++) {
System.out.printf(theList.get(i));
}
theList.remove(1);
theList.remove(3);
System.out.println();
for (int i = 0; i < theList.size(); i++) {
System.out.printf(theList.get(i));
}
}
}
墨色风雨
相关分类