我的代码:
public class MyPanel extends JPanel {
private Thread spawnRnn = new Thread(new SpawnRnn());
public MyPanel() {
spawnRnn.start();
}
public class SpawnRnn implements Runnable {
public void loadData() {}
public void run() {}
}
public class MainRnn implements Runnable {
public void run() {
spawnRnn.loadData(); //<--cannot find symbol. symbol: method loadData()
//location: variable spawnRnn of type Thread
}
}
}
我指出发生错误的地方。原因是什么,如何解决?
最佳答案
好吧,这很简单。 “ spawnRnn”的类型为“ Thread”,而不是“ SpawnRnn”