Consider the below code snippet:
import java.util.TreeSet;
import java.util.stream.Stream;
public class TreeStream {
public static void main(String[] args) {
Stream stream = Stream.of("w", "o", "l", "f","2");
TreeSet set = stream.collect(TreeSet::new, TreeSet::add,TreeSet::addAll);
System.out.println(set);
}
}
What is the output when it is executed?

 [2,f, l, o, w]
 [w,o,l,f,2]
 [2,w,o,l,f]

[w,o,l,f,2]

Verified Answer
Correct Option - a

To get all Infosys Certified Java SE8 Professional Exam questions Join Group https://bit.ly/infy_premium_group

We're passionate about offering best placement materials and courses!! A one stop place for Placement Materials. We daily post Offcampus updates and Placement Materials.

Qtr No. 213, New Town Yehlanka Indore 454775

admin@prepflix.in