Message in eine eigene Datei

This commit is contained in:
BerdanInformatik123 2021-05-13 19:45:54 +02:00
parent 6f61fbeebe
commit 1f2d46acdf
2 changed files with 30 additions and 24 deletions

View file

@ -42,27 +42,3 @@ public class Client1 {
} }
class Message implements Serializable {
String username;
String message;
//String date = new SimpleDateFormat("dd-MM-yyyy").format(new Date());
LocalDateTime current = LocalDateTime.now();
DateTimeFormatter formatter = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM);
String date = current.format(formatter);
public Message( String username, String message ){
this.username = username;
this.message = message;
//this.date = date;
}
@Override
public String toString() {
return "nickname=" + username +
", message=" + message +
", time=" + date;
}
}

30
src/client/Message.java Normal file
View file

@ -0,0 +1,30 @@
package client;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;
class Message implements Serializable {
String username;
String message;
//String date = new SimpleDateFormat("dd-MM-yyyy").format(new Date());
LocalDateTime current = LocalDateTime.now();
DateTimeFormatter formatter = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM);
String date = current.format(formatter);
public Message( String username, String message ){
this.username = username;
this.message = message;
//this.date = date;
}
@Override
public String toString() {
return "nickname=" + username +
", message=" + message +
", time=" + date;
}
}