What does the following output?
Predicate clear = c -> c.equals("clear"); System.out.println(clear.test("pink"));
B.
While it is common for a Predicate to have a generic type, it is not required.
When the generic is omitted, it is treated like a Predicate of type Object.
Since the equals()
method exists on Object, this is fine.
Option B is correct because the Predicate tests as false.