Oracle
1Z0-851 · Question #199
Which two scenarios are NOT safe to replace a StringBuffer object with a StringBuilder object? (Choose two.)
The correct answer is A. When using versions of Java technology earlier than 5.0. B. When sharing a StringBuffer among multiple threads. See the full explanation below for the reasoning.
Question
Which two scenarios are NOT safe to replace a StringBuffer object with a StringBuilder object? (Choose two.)
Options
- AWhen using versions of Java technology earlier than 5.0.
- BWhen sharing a StringBuffer among multiple threads.
- CWhen using the java.io class StringBufferInputStream.
- DWhen you plan to reuse the StringBuffer to build more than one string.
How the community answered
(32 responses)- A81% (26)
- C13% (4)
- D6% (2)
Community Discussion
No community discussion yet for this question.