What is the output of `Arrays.asList("a", "b").forEach(System.out::println);`?

  1. No output
  2. Prints 'a' and 'b' on separate lines
  3. Prints 'ab'
  4. Compilation error
Correct answer Prints 'a' and 'b' on separate lines

Explanation

The method reference prints each element on a separate line.

Update: Admin added a tag on this question

Topics

By Admin · · 24 views