⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exercise18_4.java

📁 java程序设计导论(daniel liang著) 所有偶数课后习题答案
💻 JAVA
字号:
import java.util.*;public class Exercise18_4 {  public static void main(String[] args) {    ArrayList list1 = new ArrayList(Arrays.asList(      new String[]{"George", "Jim", "John", "Blake", "Kevin", "Michael"}));    ArrayList list1Clone1 = (ArrayList)list1.clone();    ArrayList list1Clone2 = (ArrayList)list1.clone();    ArrayList list2 = new ArrayList(Arrays.asList(      new String[] {"George", "Katie", "Kevin", "Michelle", "Ryan"}));    list1.addAll(list2);    list1Clone1.removeAll(list2);    list1Clone2.retainAll(list2);    System.out.println("The union of the two sets is " + list1);    System.out.println("The difference of the two sets is " + list1Clone1);    System.out.println("The intersection of the two sets is " + list1Clone2);  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -