Identify the valid for loop constructs assuming the following declarations:
Object o = null; Collection c = //valid collection object. int [][] ia = //valid array
Select 2 options
Correct Options are : B E
For A.
Cannot use an existing/predefined variable in the variable declaration part.
For B.
final is the only modifier (excluding annotations) that is allowed here.
For C.
Each element of ia is itself an array. Thus, they cannot be assigned to an int.
For D.
c.iterator () does not return any Collection. Note that the following would have been valid:
Collection<Iterator> c = //some collection that contains Iterator objects for (Iterator it : c){ }
For E.
Since ia [0] is an array of ints, this is valid.