关於类和Main的问题
public class Main {
public static void main(String[] args) {
MyClass myclass = new MyClass();
}
void aaa(){
System.out.println("aaa");
}
}
public class MyClass {
MyClass() {
final Timer timer = new Timer();
timer.schedule(new TimerTask() {
public void run() {
timeout();
timer.cancel();
}
private void timeout() {
System.out.println("Is Timeout!");
//请问在这怎样可以访问Main里的aaa()???
}
}, 2000);
}
}
[ 本帖最后由 coolEdit 于 2010-3-25 03:31 编辑 ]