1Z0-805J Free Dumps Study Materials
Question 9: どのコードは断 片 1 をプリントしますか。
A. String arr [] = {"1", "2", "3"};
List <? extends String > arrList = new LinkedList <> (Arrays.asList (arr));
System.out.println (arrList.get (0));
B. String arr [] = {"1", "2", "3"};
List <Integer> arrList = new LinkedList <> (Arrays.asList (arr));
System.out.println (arrList.get (0));
C. String arr [] = {"1", "2", "3"};
List <?> arrList = new LinkedList <> (Arrays.asList (arr));
System.out.println (arrList.get (0));
D. String arr [] = {"1", "2", "3"};
List <?> arrList = new LinkedList <?> (Arrays.asList (arr));
System.out.println (arrList.get (0));
E. String arr [] = {"1", "2", "3"};
List <Integer> extends String > arrList = new LinkedList <Integer> (Arrays.asList (arr));
System.out.println (arrList.get (0));
Correct Answer: A,C
Explanation:
Note: You can replace the type arguments required to invoke the constructor of a generic class with
an empty set of type parameters (<>) as long as the compiler can infer the type arguments from the
context. This pair of angle brackets is informally called the diamond.