package Wxte; import java.util.Scanner; import java.util.ArrayList; public class DAKE { public static void main(String[] args) { // TODO Auto-generated method stub ArrayList <String> list = new ArrayList <String>(); list.add("欧欧 Q仔"); list.add("亚亚 Q妹"); list.add("菲菲 Q妹"); list.add("美美 Q妹"); System.out.println("总共有" + list.size() + "只企鹅"); System.out.println("分别是:"); System.out.println(); for (int a = 0; a < list.size(); a++) { System.out.println(list.get(a)); } list.remove(2); list.remove("美美 Q妹"); System.out.println(); System.out.println("分别是:"); for (int i = 0; i < list.size(); i++) { System.out.println(list.get(i)); } System.out.println(); if (list.contains("美美 Q妹")) { System.out.println("集合中包含美美的信息"); } else { System.out.println("集合中不包含美美的信息"); } } }