Oracle Java SE 21 Developer Professional 1z0-830 Question # 21 Topic 3 Discussion

Oracle Java SE 21 Developer Professional 1z0-830 Question # 21 Topic 3 Discussion

1z0-830 Exam Topic 3 Question 21 Discussion:
Question #: 21
Topic #: 3

Given:

java

StringBuffer us = new StringBuffer("US");

StringBuffer uk = new StringBuffer("UK");

Stream stream = Stream.of(us, uk);

String output = stream.collect(Collectors.joining("-", "=", ""));

System.out.println(output);

What is the given code fragment's output?


A.

US-UK


B.

An exception is thrown.


C.

-US=UK


D.

=US-UK


E.

Compilation fails.


F.

US=UK


Get Premium 1z0-830 Questions

Contribute your Thoughts:


Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.