class mythread implements Runnable { Thread t; public mythread(String title) { t=new Thread(this,title); t.start(); } public void run() { for(int i=0;i { System.out.println((i+1)+"Thread Name:"+Thread.currentThread().getName()); try { Thread.sleep(100); } catch(Exception e) { } }}} public class slip18 { public static void main(String a[]) { System.out.println("Thread name:"+Thread.currentThread().getName()); mythread mt=new mythread("Hello Java"); } }
Write a JAVA program to display”Hello Java” 50 times using multithreading.
Reviewed by
on
April 27, 2015
Rating: