Filed under Thread

Multithreading in java

public class threads extends Thread { public static void main(String[] args) { Thread thread1 = new Thread () { public void run () { try { for(int i=1; i<=10;i++) { System.out.println(“First Thread :”+i); Thread.sleep(1000); } } catch(InterruptedException ie) { } } }; Thread thread2 = new Thread () { public void run () { try … Continue reading