Monitors
AIM: the main aim this program is to use a Synchronized method to lock an object by using monitors
Source Code:
public class MonitorsExample{
public synchronized void m() {
n();
System.out.println("this is m() method");
}
public synchronized void n() {
System.out.println("this is n() method");
}
public static void main(String args[]){
final MonitorsExample re=new MonitorsExample();
Thread t1=new Thread(){
public void run(){
re.m();//calling method of Reentrant class
}
};
t1.start();
}}
1 Comments:
Great Article
Final Year Projects in Python
Python Training in Chennai
FInal Year Project Centers in Chennai
Python Training in Chennai
Post a Comment
Subscribe to Post Comments [Atom]
<< Home