⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 message.java

📁 JAVA的聊天源代码
💻 JAVA
字号:
package qq;

import java.io.Serializable;

public class Message implements Serializable {

    //变量声明
    private int fromId;
    private String fromName;
    private int toId;
    private String time;
    private String message;

    //无参构造
    public Message() {

    }

    //有参构造
    public Message(int fromId, String fromName, int toId, String time,
                   String message) {
        this.fromId = fromId;
        this.fromName = fromName;
        this.toId = toId;
        this.time = time;
        this.message = message;
    }

    //设置属性
    void setFromId(int fromId) {
        this.fromId = fromId;
    }

    void setFromName(String fromName) {
        this.fromName = fromName;
    }

    void setToId(int toId) {
        this.toId = toId;
    }

    void setTime(String time) {
        this.time = time;
    }

    void setMessage(String message) {
        this.message = message;
    }

    //获得属性
    int getFromId() {
        return this.fromId;
    }

    String getFromName() {
        return this.fromName;
    }

    int getToId() {
        return this.toId;
    }

    String getTime() {
        return this.time;
    }

    String getMessage() {
        return this.message;
    }


    public String toString() {
        return "【" + this.fromName + "】  " + this.time + "\n" + this.message;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -