Categories
Uncategorized

Synchronization of Thread

Q) WAP to implements Thread Synchronization in Java. import java.util.Scanner; class Table{         void printTable(int n){       synchronized(this){//synchronized block       for(int i=1;i<=10;i++){             System.out.println(n+”*”+i+”=”+n*i);       try{               Thread.sleep(400);           }catch(Exception e){System.out.println(e);}        }      }           } }    public class sync{       public static void main(String args[])     {           final Table obj = new Table();//only one […]