JAVA Programming :: Basic Concepts - Discussion
20 / 64
Which keyword when applied on a method indicates that only one thread should execute the method at a time. Select the one correct answer.
Atransient
Bvolatile
Csynchronized
Dnative
Estatic
Show Explanation
If multiple threads are trying to operate simultaneously on the same java object, then there may be a chance of Data Inconsistency Problem.
To overcome this problem, we should go for synchronized keyword.
If a method or block is declared as synchronized then at a time only one thread is allowed to execute that method or block on the given object, so that Data Inconsistency problem will be resolved.
Asked In ::
synchronized is the modifier applicable only for methods and blocks, but not for classes and variables.
If multiple threads are trying to operate simultaneously on the same java object, then there may be a chance of Data Inconsistency Problem.
To overcome this problem, we should go for synchronized keyword.
If a method or block is declared as synchronized then at a time only one thread is allowed to execute that method or block on the given object, so that Data Inconsistency problem will be resolved.
Read Full Answer
Report Error
Please Login First Click Here