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)
哪位知道解决办法请告诉在下,谢谢。
解决方案 »
- 关于调用方法时是否默认调用构造器
- 如何关闭一个JDialog而不影响JFrame,我是一关JDialog连带JFrame也关了
- 很简单的报错却改不了,等着明天交 DDA画直线算法的作业的,希望今晚有人能替我解决
- 急求助:EJB中怎样让某个类随容器启动?
- java怎样实现文件拷贝?
- 怎样用swing 实现在读取一个很大的文件的同时弹出一个窗口显示读取进度?
- 连ms-sql的问题
- 愿送100分,有谁能解释这幅图的关系及意思?
- 求教JAVA高手:如何父对话框中得到子对话框中的内容
- java 线程问题,关于使用开始和暂停按钮实现读取并显示大量数据
- setBounds设定位置不管用怎么办?
- servlet中文编码出现乱码的问题
还是出同样的毛病。