为何我的程序执行数据库操作不能马上提交 while(true){ //采用无限循环的方式-------------------------------------------------------好像没有出口呀 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在上面得到mo_table记录函数:public Mo_total_table getMoMsg()中返回值是不是有问题呢?因为我把主函数该为:/*主函数*/public static void main(String[] args)throws Exception{ connectionDB = new ConnectionData(); //连接数据库 Chat_mothed mothed = new Chat_mothed();//构建方法类 while(true){ //采用无限循环的方式 moMsg = mothed.getMoMsg(connectionDB);//取信息记录 while(moMsg!=null){ System.out.print(moMsg.msgcontent); //打印内容 int id = moMsg.id; //取得该信息id mothed.flagMo(id, connectionDB); //修改标志 } } }这时程序没有动静,不打印内容,如果将while(moMsg!=null)该为while(!moMsg.equals(null)){--}时,得到的是空指针的异常。我该怎么该呀? 郁闷,不习惯you的代码方式,不看了 怎样返回光标所在的文本框 简单问题求教! 我把JTextArea放入JScrollPane中实现垂直滚动功能,但是为什么每次滚动的时候,滚动条总是在上方?如何调整使滚动条再下方啊 一个很有意思的问题的算法 关于java编辑器的下载 怎样在swing上加图形 请求解释一行代码的原理 录入界面里面有 照片,请大家帮忙,怎么作? 关于异常的捕获 对于java,谁能告诉我,初学者应该如何入手? 讨论一下,java中的成员方法和static方法的区别 非web项目中数据库连接池的配置
在上面得到mo_table记录函数:public Mo_total_table getMoMsg()中返回值是不是有问题呢?因为我把主函数该为:
/*主函数*/
public static void main(String[] args)throws Exception{
connectionDB = new ConnectionData(); //连接数据库
Chat_mothed mothed = new Chat_mothed();//构建方法类
while(true){ //采用无限循环的方式
moMsg = mothed.getMoMsg(connectionDB);//取信息记录
while(moMsg!=null){
System.out.print(moMsg.msgcontent); //打印内容
int id = moMsg.id; //取得该信息id
mothed.flagMo(id, connectionDB); //修改标志
}
}
}
这时程序没有动静,不打印内容,如果将while(moMsg!=null)该为while(!moMsg.equals(null)){--}时,得到的是空指针的异常。
我该怎么该呀?