To execute the threads one after another

Options
- the keyword synchronize is used
- the keyword synchronizable is used
- the keyword synchronized is used
- None of the above


CORRECT ANSWER : the keyword synchronized is used

Discussion Board
english

hiii

saniya 08-17-2021 11:25 PM

misleading question caption

I suggest that in the view of a test the caption "To execute the threads one after another" is misleading as:
a) a thread cannot be "executed";
b) in context of synchronized the correct caption would be "What provides data consistency when multiple threads are running?".

Andrew Frolov 09-5-2016 10:11 AM

java

java is an interesting

Gebreslassie Taddesse 08-20-2015 08:23 AM

Execution of threads

Synchronized methods are used to execute threads one after another in synchronized manner. As they enable threads to interfere with each other and allow the memory to function properly without showing any consistency errors. Synchronized method ensures that if an object is visible to more than one thread, all reads or writes to that object's variables are done in synchronized manner. Whenever a synchronized method exits from the function or working then it automatically creates a happens-before relationship with any subsequent invocation of a synchronized method for the same object. This way the change in state becomes visible to all the threads.

Rohit Sharma 07-26-2014 07:19 PM

Write your comments


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)


Advertisement