Answer Posted / venod.r.g
Thread is a class which extends Thread class or Implements
Runnable Interface.
Thread can run as an Independant process than current
Excecution steps. The Main thread that runs always is known
as CurrentThread accessed by Thread.currentThread();
Only one thread can access CPU time ( JVM then CPU). Multi
thread mechanisum is possible by making several threads in
waiting state and running only one at a time.
JVM assign priorities for every threads and accesses in a
Time Slicing / scheduled way considering the OS.
Defauls is normal.
Every object is like a Football to threads. hence Every
object must have methods to handle a thread. All the
players may be running in the field but only one player can
handle the Ball at a time. Object have methods like wait(),
notify() notifyAll() etc to catch and release the working
thread.
If you do not want a ball to change shape once it is
accessed by a thread then you need to synchronise the
statements or methods. Once synchronized the thread which
is the owner of the Object can only change the state of the
object.
//Method
public void synchronized x(){
}
//statement
synchronized (x);
| Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
What is the concatenation operator in java?
What is the map interface in java programming?
What do you mean by an interface in java?
What is final method?
What is a modifier?
How do you reverse a string in java?
Is 0 a prime number?
Is main an identifier?
How many bytes are there?
How do you check if a character in a string is a digit or letter?
What is static variable with example?
What is time complexity algorithm?
What is the latest version of java?
How many types of literals are there in JAVA?
What is anonymous inner class?