class
ClassA
{ synchronized public void
method1 ()
{
}
synchronized public void
method2 ()
{
method1();
} }
Solution
In the given example both "method1" and "method2" are synchronized methods. But "method1" has been invoked inside "method2". This may result in a deadlock situaton.So, this should be avoided.