Which of the following compiles and print outs the entire set? (Choose all that apply.)
Set<String> s = new HashSet<>(); s.add("lion"); s.add("tiger"); s.add("bear"); s.forEach( );
F.
Choice A is incorrect because forEach takes a Consumer parameter, which requires one parameter.
Choices B and C are close.
The syntax for a lambda is correct.
However, s is already defined as a local variable and therefore the lambda can't redefine it.
Choices D and E use incorrect syntax for a method reference.
Choice F is correct.