Multithreading Example in Java

package multithreading;
public class Multithreading
public static void main(String[] args)
mthread thread1 = new mthread(“piit”);
mthread thread2 = new mthread(“new panvel”);
class mthread extends Thread
String a;
public void run()
for(int i=0;i<=3;i++) { System.out.println(" "+a); try { Thread.sleep(500); }catch(Exception e){}; } } mthread(String b) { a=b; } } [/java]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.