最近作程序,出现一种异常我不太明白:while (!stop) {
String str = dis.readUTF();//这一行if (str != null) {
......}} 这是客户端读信息的代码,服务端用dos.writeUTF()方法写信息;客户端第一次读信息没有问题,可是第二次执行的时候,一运行到标注的行,就会抛IOException异常,用e.getMessage方法看了一下,居然是空的。查了一下api文档:the error message string of this Throwable object if it was created with an error message string; or null if it was created with no error message.我不太明白,既然no error message,为什么还会抛异常,还是null。