1.

Which is the new method introduced in java 8 to iterate over a collection?(a) for (String i : StringList)(b) foreach (String i : StringList)(c) StringList.forEach()(d) List.for()The question was posed to me in final exam.This interesting question is from Java 8 Features topic in chapter Autoboxing & Miscellaneous of Java

Answer»

Correct ANSWER is (C) StringList.forEach()

For EXPLANATION: TRAVERSING through forEach method of Iterable with anonymous CLASS.



Discussion

No Comment Found

Related InterviewSolutions