Not all objects can be easily shared between threads in Java. Do you know which ones are thread-safe? Check fifty third question of full-stack dev quiz to verify that.
Objects of which classes are thread-safe?
Choose all valid options.
- Integer
- AtomicInteger
- Long
- StringBuffer
- StringBuilder
For the correct answer scroll down
.
.
.
.
.
.
The correct answer is: b, d. If you would like to read more, check Thread-safe alternative to i++ article.