Given:
2. import java.util.*; 3. class Shape { 4. static List<String> s1 = new ArrayList<String>(); 5. } /*ww w .ja va 2 s. com*/ 6. public class Main extends Shape { 7. public static void main(String[] args) { 8. List c1 = new ArrayList(); 9. s1.add("1"); s1.add("2"); 10. c1.add("3"); c1.add("4"); 11. getShape(s1, c1); 12. } 13. static void getShape(List<String> a1, List a2) { 14. for(String s1: a1) System.out.print(s1 + " "); 15. for(String s2: a2) System.out.print(s2 + " "); 16. } }
What is the result? (Choose all that apply.)
F is correct.
When getting elements from a non-generic collection, a cast (from Object) is required.
The rest of the code is legal.