QuestionQ17

Working with Streams and Lambda expressions

Given:

Question Image

and this code fragment:

Question Image

What is the outcome?

  • A Marketing
  • B Marketing -Finance -Technical
  • C Marketing -UnDefined
  • D UnDefined
Explanation

valueOf("CMO") resolves to the enum constant CMO because enum lookup requires the exact declared constant name. The switch therefore selects case CMO and prints Marketing. The unused stream pipeline does not print anything. Java Enum API

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!