Hi all,
Just a few queries in threads
1. What is the difference between sleep(long) and yield() method(arnt both doing the same task of giving a chance for other threads?)
2. Consider the following code
class A{
synchronize meth(){}
synchronize meth1(){};
}
can we call meth() and meth1() on the same thread ie say t.meth() and t.meth1() simultaneously ie can we call these methods with the same object reference?
3. When a static method is synchronized and is called, can synchronized methods of instance methods of the same class be called at the same time? Or are they mutually exclusive?(as static locks the entire class)
4.for synchronized blocks what does this mean.
synchronized(<object reference>
does this mean that the thread should first acquire lock on the object of object reference before we enter the blocks code?
Regards ,
Yashwanth