Answer Posted / john noah
In a single threaded system program executes in a sequence
line by line. Multithreaded system can allow multiple
threads to execute a program parallel in multiple instances.
If there is any part of code dealing with the object data
modification, there is no guarantee that it will not be
attempted any more than one thread at a time.
there's a need to make sure that such kind of code should be
executed exclusively. To achieve this in Java we a concept
of LOCK. Using Lock mechanism thread holds complete hold on
an object and object is also can not be access any other
thread except the thread holding that lock. Lock is an
object level control and one thread only can hold it at a time.
| Is This Answer Correct ? | 8 Yes | 0 No |
Post New Answer View All Answers
Can we convert stringbuilder to string in java?
What is the diffrence between inner class and nested class?
What is the default value of byte datatype in java?
Say you want to store the information about a number of pets in an array. Typical information that you could store for each pet (where relevant) would be • Breed of animal • Animal's name • Its birth date • Its sex • Whether it has been sterilised or not • When it is due for its next inoculation • When it last had its wings clipped For each type of pet (eg. dog, cat or bird) you would typically define a class to hold the relevant data. Note: You do not need to implement these classes. Just answer the following questions. 3.1.1 What would be the advantage of creating a superclass (eg. Pet) and declaring an array of Pet objects over simply using an array of Objects, storing each of the instances of the different pet classes (eg. Dog, Cat or Bird) in it? 3.1.2 Would you define Pet as a class or as an interface? Why? (2) (2)
What are mutable classes?
Explain the difference between transient and volatile in java?
What is sortedmap interface?
Give any two differences between C++ and java.
Explain restrictions for using anonymous inner classes?
Define canvas?
What is matcher in java?
What is the purpose of return statement?
Give differences between Quicksort & Mergesort. When should these sorts be used and what is their running time?
how we can make a write-only class in java?
What is immutable in java?