import java.util.*;
public void printStrings (List stringList) {
if (stringList != null) {
Iterator li = stringList.iterator();
while (li.hasNext()) {
System.out.println( (String) li.next());
}
}
}
Which one of the following statements highlights the assumed risk of potential run-time error in the above code?
Choice 1
System.out may have been redirected to a file rather than the terminal.
Choice 2
You do not know that stringList contains only String objects, so the cast could fail.
Choice 3
You need to check the size of the List using its size() method before accessing it so you do not read past the end of the list.
Choice 4
Since printStrings returns "void," you have no way to return a failure code.
Choice 5
The object referenced by stringList may or may not implement the iterator() method.
I have got no idea on this question.... so tx for an explaination of answer in advance........
