为什么会出现Syntax error on token "}", { expected错误
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.io.Serializable;
public abstract class Message implements Externalizable {
ChatFrame frame = new ChatFrame();
String str;
String msg;
int num;
// abstract void putOut() { // 测试
//// System.out.println(msg + num);
// }
public void writeExternal(ObjectOutput out) throws IOException {
out.writeObject(msg);
out.write(88); // 在序列化的数据最后加个88
}
public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
msg = (String) in.readObject();
num = in.read(); // 把数字88加进来
}
}
class LoginMessage extends Message {
public void Login(){
str = frame.nameField.getText();
msg = (str + "_上线了!");
}
public void writeExternal(ObjectOutput out) throws IOException {
out.writeObject(msg);
out.write(88); // 在序列化的数据最后加个88
}
public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
msg = (String) in.readObject();
num = in.read(); // 把数字88加进来
}
}
class OutlineMessage extends Message {
public void OutlineMessage() {
str = frame.nameField.getText();
msg = str + "_下线了!";
}
public void writeExternal(ObjectOutput out) throws IOException {
out.writeObject(msg);
out.write(88); // 在序列化的数据最后加个88
}
public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
msg = (String) in.readObject();
num = in.read(); // 把数字88加进来
}
}
class TalkMessage extends Message {
public void Online() {
msg = (frame.nameField.getText() + "说:" + frame.sendField
.getText());
}
public void putOut(){
System.out.println(msg);
}
public void writeExternal(ObjectOutput out) throws IOException {
out.writeObject(msg);
out.write(88); // 在序列化的数据最后加个88
}
public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
msg = (String) in.readObject();
num = in.read(); // 把数字88加进来
}
}
}
}