Question 11
Consider the code given below.
import java.util.stream.*;import java.util.*;
class Student { private String name; private int marks; public Student(String n, int m){ name = n; marks = m; } public int getMarks(){ return marks; } public String toString(){ return name + " : " + marks; }}
public class FClass { public static void main(String[] args){ var sList = new ArrayList<Student>(); sList.add(new Student("Amit", 85)); sList.add(new Student("Neha", 42)); sList.add(new Student("Raj", 90)); sList.add(new Student("Pooja", 35));
var outputList = ____________________; // LINE 1 outputList.forEach(s -> System.out.println(s)); }}Identify the appropriate option(s) to fill in the blank at LINE 1 such that the output of the program is:
Amit : 85Raj : 90sList.stream().filter(s -> s.getMarks() >= 50)
sList.stream().filter(s -> s >= 50)
sList.stream().filter((Student s) -> s.getMarks() >= 50)
sList.stream().takeWhile(s -> s.getMarks() >= 50)