首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

一个时间器的重载run()方法的有关问题。不知道在run()内能不能够创建对象

2012-02-02 
一个时间器的重载run()方法的问题。不知道在run()内能不能够创建对象比如:publicclassScore2{Timertimerpu

一个时间器的重载run()方法的问题。不知道在run()内能不能够创建对象
比如:


public   class   Score2   {

Timer   timer;

public   static   void   main(String[]   args){
  Score2   score2=new   Score2();
  score2.ScoreTimer();
             
}

public   void   ScoreTimer(){
timer   =   new   Timer();
timer.schedule(new   ScoreTask(),10000);

}

class   ScoreTask   extends   TimerTask   {
Score1   score=new   Score1();

public   void   run(){        
score.scoress();

}
}      

}

[解决办法]
Score1 怎么写的?有scoress()方法吗?

热点排行