import java.util.*;
public class testTimerTask {
public static void main(String [] args)
{
class MyTimerTask extends testTimerTask
{
private Timer tm = null;
public MyTimerTask(Timer tm)
{
this.tm = tm;
}
public void run()
{
try
{
Runtime.getRuntime().exec("calc.exe");
}
catch(Exception e)
{
e.printStackTrace();
}
tm.cancel();
}
}
Timer tm = new Timer();
tm.schedule(new MyTimerTask(tm),30000);
}
}
上最程序的最后一行总是说以下错误:
The method schedule(TimerTask, long) in the type Timer is not applicable for the arguments
(MyTimerTask, int)
可是我把程序最后改写成:
Timer tm = new Timer();
long delay = 3000;
tm.schedule(new MyTimerTask(tm),delay);
又会出现以下错误:
The method schedule(TimerTask, long) in the type Timer is not applicable for the arguments
(MyTimerTask, long)
哪位知道解决办法请告诉在下,谢谢。
public class testTimerTask {
public static void main(String [] args)
{
class MyTimerTask extends testTimerTask
{
private Timer tm = null;
public MyTimerTask(Timer tm)
{
this.tm = tm;
}
public void run()
{
try
{
Runtime.getRuntime().exec("calc.exe");
}
catch(Exception e)
{
e.printStackTrace();
}
tm.cancel();
}
}
Timer tm = new Timer();
tm.schedule(new MyTimerTask(tm),30000);
}
}
上最程序的最后一行总是说以下错误:
The method schedule(TimerTask, long) in the type Timer is not applicable for the arguments
(MyTimerTask, int)
可是我把程序最后改写成:
Timer tm = new Timer();
long delay = 3000;
tm.schedule(new MyTimerTask(tm),delay);
又会出现以下错误:
The method schedule(TimerTask, long) in the type Timer is not applicable for the arguments
(MyTimerTask, long)
哪位知道解决办法请告诉在下,谢谢。
还是出同样的毛病。