Question 23
Consider the Java code given below.
import java.util.*;public class SetTest { public static void main(String[] args) { ArrayList<String> list = new ArrayList<String>(); list.add("Java"); list.add("Programming"); list.add("Python"); list.add("Script"); // CODE BLOCK for(String str:list) { set1.add(str); set2.add(str); } for(String str:set1) System.out.print(str+" "); System.out.println(); for(String str:set2) System.out.print(str+" "); }}Choose the correct option(s) to be filled in place of CODE BLOCK so that the program always generates the following output:
Java Programming Python Script
Java Programming Python Script