pls tell the reason why floating value is chaning on casting to double even when it can hold the interger.max value... ?
If a thread is accessing a method, which is marked as synchronized, the thread will need the lock of the object that is represented by the class the method is defined in. Ergo, no other thread would be able to access any other synchronized methods in the same class.
Please see the modified example of yours below.
once one of threads enters one of the synchronized methods in the ZZ class, the other thread can't enter the other method until it has finished...
Are there any exceptions that do not inherit from Exception?
Inside the Matrix constructor,method1 of Matrix is called
it prints "You are inside method 1 of Matrix"
I think it should be "copy of a reference" that gets passed as a parameter.