慕粉4206482
2016-11-08 11:03
Thread armyOfDynasty = new Thread(armyTaskOfSuiDynasty, "隋军");
//这句出错,错误: The constructor Thread(ArmyRunnable, String) is undefined
Thread armyOfRevolt = new Thread(armyTaaskOfRevolt, "农民军");
//这句同上错误
armyOfDynasty.start();
armyOfRevolt.start();
try {
Thread.sleep(50);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
armyTaskOfSuiDynasty.keepRunning = false;//这句出错,错误是:keepRunning cannot be //resolved or is not a field
armyTaaskOfRevolt.keepRunning = false;//这句同上
你有书吗?再看一下关于runnable线程的创建,你必须得先创建Runnable接口实现类的实例再创建Thread线程呀
上面肯定少了东西,仔细检查
深入浅出Java多线程
186088 学习 · 464 问题
相似问题
回答 2