我的代码:
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
}
}
}
我指出了发生错误的地方。是什么原因以及如何解决?