A)
if we have 3 synchronized methods inside same obj, then must be executed (by another obj) in case,
all synchronized methods in queue, after another obj execute the synchronized methods again all (finished), after other, and so on...? queue of synchronized methods get executed by one after the other obj, required be the same?
B)
in a class obj we have 3 synchronized methods and 3 UN-synchronized methods, well, when an obj-A call 1st synchronized method and finish, may an obj-B call 1st synchronized method and finish, AFTER obj-A call 2nd synchronized method
all sychr methods same obj and so on... ?
C)
I]A
thread may acquire 2 or more Locks of synchronized methods/blocks. TRUE/FALSE
II]When we have Two or more Static synchronized methods same class, this is correct (below)?
MyClass.class
.....
public static synchronized int getCount() {
return count;
}
public static synchronized int getCount2() {
return count;
}
.....
OR
MyClass.class
.....
public static int getCount() {
synchronized(MyClass.class) {
return count;
}
}
public static int getCount2() {
synchronized(MyClass.class) {
return count;
}
}
.....