aboutsummaryrefslogtreecommitdiff
path: root/sem5/oop/m7/src/TextMessage.java
diff options
context:
space:
mode:
Diffstat (limited to 'sem5/oop/m7/src/TextMessage.java')
-rw-r--r--sem5/oop/m7/src/TextMessage.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/sem5/oop/m7/src/TextMessage.java b/sem5/oop/m7/src/TextMessage.java
new file mode 100644
index 0000000..f5f5c74
--- /dev/null
+++ b/sem5/oop/m7/src/TextMessage.java
@@ -0,0 +1,14 @@
+import java.io.Serializable;
+
+public class TextMessage extends Message implements Serializable {
+ private String msg;
+
+ public TextMessage(String from, String to, String msg) {
+ super(from, to);
+ this.msg = msg;
+ }
+
+ public void handle(Node node) throws Exception {
+ System.out.printf("%s >> %s%n", this.from, this.msg);
+ }
+}