import java.util.*; class SetOperations { public static void main (String[] args) { TreeSet s = new TreeSet(); s.add("mno"); s.add("jkl"); s.add("ghi"); TreeSet t = new TreeSet(); t.add("def"); t.add("abc"); t.add("ghi"); // Add all of the elements of t to s (set union) s.addAll(t); // next statement prints [abc, def, ghi, jkl, mno] System.out.println(s); // Remove all elements of t from s (set difference) s.removeAll(t); // next statement prints [jkl, mno] System.out.println(s); } }