Which two scenarios are NOT safe to replace a StringBuffer object with a StringBuilder object? (Choose two.)

Which two scenarios are NOT safe to replace a StringBuffer object with a StringBuilder object? (Choose two.)

Which two scenarios are NOT safe to replace a StringBuffer object with a StringBuilder object? (Choose two.)

A.
When using versions of Java technology earlier than 5.0.

B.
When sharing a StringBuffer among multiple threads.

C.
When using the java.io class StringBufferInputStream.

D.
When you plan to reuse the StringBuffer to build more than one string.

Explanation:



Leave a Reply 4

Your email address will not be published. Required fields are marked *


dagimon

dagimon

A) – StringBuilder is available since 1.5.
B) – StringBuilder is not synchronized. Sharing among multiple not safe.

Kanthi

Kanthi

A- StringBuilder is introduced in JDK 1.5
B- StringBuilder’s access is not synchronized so that it is not thread safe.

sOne

sOne

For those who are taking the Java SE6 test…

These are the ONLY questions you ever need to know. I took test today and scored 96%. Means I got just two questions wrong. During practice I scored 230/236 here and I assumed I can get 70%.

The questions and options are IDENTICALLY the same. Even the options are NOT CHANGING the order randomly. They are given in the exam as listed here.

Good luck