Question 6
Given the code fragment:
Which is the valid definition of the Course enum?
Question 7
Given the code fragment:
List<String> colors = Arrays.asList("red", "green", "yellow");
Predicate<String> test = n - > {
System.out.println("Searching...");
return n.contains("red");
};
colors.stream()
.filter(c -> c.length() > 3)
.allMatch(test);
What is the result?
Question 8
Given the code fragment:
public static void main (String [ ] args) throws IOException {
BufferedReader br = new BufferedReader (new InputStremReader (System.in));
System.out.print ("Enter GDP: ");
/ /line 1
}
Which code fragment, when inserted at line 1, enables the code to read the GDP from the user?
Question 9
Given the code fragment:
Which code fragment, when inserted at line 7, enables printing 100?
Question 10
Given:
And given the code fragment:
What is the result?
