现在的问题是,输入EXIT或exit都可以正确退出,但是输入别的字符的时候不能正确的退出,我希望的是输入其他字符的时候无反映,else应该怎么写?谢谢各位
try
{
ConnectionDB.getConnection();
while(true)
{
controller.start();
//State == 线程是否正常运行 getState -- 获得服务器的核心处理线程的状态
while (Thread.State.RUNNABLE != controller.getState())
{
}
String command = reader.readLine();
if ("exit".equals(command) || "EXIT".equals(command))
{
controller.interrupt();
break;
}
else
{
***************************************************这里*********************
}
}
} catch (Exception ex) {
System.out.println("main:" + ex);
}
System.exit(0);
try
{
ConnectionDB.getConnection();
while(true)
{
controller.start();
//State == 线程是否正常运行 getState -- 获得服务器的核心处理线程的状态
while (Thread.State.RUNNABLE != controller.getState())
{
}
String command = reader.readLine();
if ("exit".equals(command) || "EXIT".equals(command))
{
controller.interrupt();
break;
}
else
{
***************************************************这里*********************
}
}
} catch (Exception ex) {
System.out.println("main:" + ex);
}
System.exit(0);
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货