ok..my aim is to run 2 threads concurrently...let s have a lokk at the following code....
import java.io.*;
import java.util.*;
class testtimer extends TimerTask
{
public void run()
{
System.out.println("timer started");
}
}
class testtimer2 extends TimerTask
{
public void run()
{
System.out.println("timer 2 started");
}
}
class maintimer
{
public static void main(String args[])
{
testtimer t1=new testtimer();
testtimer2 t2=new testtimer2();
Timer tm=new Timer(true);
tm.schedule(t1,1000,1000);
tm.schedule(t2,1500,500);
try
{
Thread.sleep(10000);
}
catch(Exception e)
{
System.out.println("Exception occurred");
}
}
}
now suppose i want to run this program till to computer shutdown....
and i also want to fix the execution time of both the timertask thread..