Latest Oracle 1Z0-851 Exam Dumps Free Download with PDF & VCE

Vendor: Oracle
Exam Code: 1Z0-851
Exam Name: Java Standard Edition 6 Programmer Certified Professional Exam

QUESTION 1
Given a pre-generics implementation of a method:
public static int sum(List list) {
int sum = 0;
for ( Iterator iter = list.iterator(); iter.hasNext(); ) {
int i = ((Integer)iter.next()).intValue();
sum += i;
}
return sum;
}
What three changes allow the class to be used with generics and avoid an unchecked warning? (Choose three.)

A.    Remove line 14.
B.    Replace line 14 with “int i = iter.next();”.
C.    Replace line 13 with “for (int i : intList) {“.
D.    Replace line 13 with “for (Iterator iter : intList) {“.
E.    Replace the method declaration with “sum(List<int> intList)”.
F.    Replace the method declaration with “sum(List<Integer> intList)”.

Answer: ACF

Continue reading