Which of the following is a thread safe?
Answers
Answered by
3
Answer:
Since String is immutable in Java, it's inherently thread-safe. 2) Read-only or final variables in Java are also thread-safe in Java. 3) Locking is one way of achieving thread-safety in Java. ... 5) Example of thread-safe class in Java: Vector, Hashtable, ConcurrentHashMap, String, etc.
Answered by
0
The correct question is
What is a thread-safe?
The correct answer is
Thread safety is the turning away of knowledge races situations during which data are set to either correct or incorrect values,
- relying upon the order in which multiple threads access and modify the data.
- once no sharing is intended, offer every thread a personal copy of the data.
- The gathering categories that are thread-safe in Java are Stack, Vector, Properties, Hashtable, etcetera
- Thread safety is suggested when the net server runs multiple threads of execution at the same time for various requests.
- In Thread Safety binary will add a multi-threaded web server context.
- Thread Safety works by making an area storage copy in each thread so that the information won't touch another thread.
- Thread-safety or thread-safe code in Java refers to code which will safely be utilised or shared in a coinciding or multi-threading atmosphere and that will behave as expected.
#SPJ3
Similar questions