Math, asked by aswani7942, 2 months ago

public static int sum(Listlist){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 anunchecked warning?1) Remove line 42) Replace line 4 with "int i = iter.next();"3) Replace line 3 with "for (inti :intList){114) Replace the method declaration with "sum(List intList)".​

Answers

Answered by venugopalkrishna
1

Step-by-step explanation:

int sum=0;

for(iterator iter=list.iterator();

iter.hasNext();

Similar questions