Multi Threading
Multi Threading
PROGRAM:
import java.io.*;
class evenThread extends Thread
{
evenThread()
{
super("demothread");
start();
}
catch(InterruptedException ie)
{
System.out.println(ie);
}
System.out.println("even thread terminates");
}
}
catch(InterruptedException ie)
{
System.out.println("even thread terminates");
}
}
}
catch(InterruptedException ie)
{
System.out.println("multilpe5 thread terminates");
}
}
}
class sample
{
public static void main(Stirng str[])
{
evenThread t=new evenThread();
oddThread t1=new oddThread();
multiple5Thread t2=new multilpe5Thread();
try
{
Thread.join();
Thread1.join();
Thread2.join();
}
catch(InterruptedException ie)
{
System.out.println(ie);
}
System.out.println("Main thread terminates");
}
}