首页 > 解决方案 > Java NetBeans 显示消息发送时间

问题描述

我制作了 Time 和 Date 类,以便在实际消息旁边显示消息发送的时间。

**类时间 { public static void Timu(String[] args){

    LocalTime time = LocalTime.now();
    System.out.println(time);
}

}**

    **try{
        s = new Socket("127.0.0.1",8189);
        din = new DataInputStream(s.getInputStream());
        dout = new DataOutputStream(s.getOutputStream());
        String msgin="";
        while(!msgin.equals("exit")){
            msgin=din.readUTF();
            
            Time a = new Time();
            jTextArea1.setText(a.toString()+jTextArea1.getText().trim()+"\nServer:\t" + msgin);
        }**
                    

它不断给我类似 Chat.Time@100fc185 的结果,而不是实际的 LocaTime。

任何帮助将不胜感激。

标签: netbeanschat

解决方案


推荐阅读