how to code in netbeans using intersection code example Example: set intersection java set1.retainAll(set2);