How to Schedule Thread ?

Hi Everybody,

Task : i need to execute println("some message") on specific date

Description : i am using TimerTask & Timer class to Schedule thread. But i want execution on some date. follows are code

import java.io.File;

class Demo extends TimerTask

{

public Date td;

public Demo(Date d)

{

this.td = d;

}

public void run()

{

System.out.println("Deepak singh");

}

}// End of Class

public class TimerDemo

{

public static void main(String arg[])

{

Date d1 = new Date(2007,06,27,0,1,0);

Demo d = new Demo(new Date());

Timer t = new Timer();

t.schedule(d,d1);

}

}

Note : change your system time and Date( 11:58:00 ) before executing the code and see there is no result after date achieved nothing is result.

plz help me ............................

Thanks

[931 byte] By [deepak_thinksa] at [2007-11-27 11:34:03]
# 1

Use the code formatting tags so your posted code does not look like a horrible mess of gibberish.

And I'm not entirely sure what your trying to accomplish? Is the the timer task supposed to fire only on the date specified?

c0demonk3ya at 2007-7-29 16:55:06 > top of Java-index,Java Essentials,Java Programming...