Jay Roy
asked on
synchronized with subclass
hi guys
Object2 extends Object1
public class MyClass{
...
Object1 object1 = new Object1();
Object2 object2 = new Object2();
.....
....
synchronized( object1){
// code 1
}
//code 2
synchronized( object 2){
// code 3
}
}
When thread t1 executes code1, can thread t2 execute code3 at the same time?
thanks.
Object2 extends Object1
public class MyClass{
...
Object1 object1 = new Object1();
Object2 object2 = new Object2();
.....
....
synchronized( object1){
// code 1
}
//code 2
synchronized( object 2){
// code 3
}
}
When thread t1 executes code1, can thread t2 execute code3 at the same time?
thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Object2 object2 = new Object2();
Object1 object1 = object2;