I have written this code and this generate the error like Illegal start of expression on the line of run() method ,please solve my problem.
class Reentrant
{
public synchronized void m()
{
n();
System.out.println("this is m() method");
}
public synchronized void n()
{
System.out.println("this is n() method");
}
{
public void run(){
m();//calling method of Reentrant class
}
};
}
class ReentrantExample
{
public static void main(String args[])
{
Reentrant re=new Reentrant();
Thread t1=new Thread();
t1.start();
}
}
}before therunmethod that needs to be removed it seems.