From 1690d0f9e48e6fedf04c1469473d9c461eba9574 Mon Sep 17 00:00:00 2001 From: Oleksii Aleshchenko Date: Thu, 13 Apr 2023 16:07:52 +0300 Subject: [PATCH] upd lab3 // add todo for lab4 --- src/Lab3.java | 14 ++++++++++++-- src/lab4/Main.java | 7 +++++++ 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 src/lab4/Main.java diff --git a/src/Lab3.java b/src/Lab3.java index 1bf2cf0..4d5c3f1 100644 --- a/src/Lab3.java +++ b/src/Lab3.java @@ -1,6 +1,11 @@ public class Lab3 { public static void main(String[] args) { String s = "ASD"; + + StringBuilder stringBuilder = new StringBuilder("ASD"); + + stringBuilder.append("A"); + String s2 = s; System.out.println("s2 = " + s2); System.out.println(s == s2); // true? @@ -18,8 +23,13 @@ public class Lab3 { // String Pool String s4 = "ASD"; - System.out.println(s4 == s2); // true? - System.out.println(s4.equals(s2)); // (true) +// String s5 = new String("ASD"); + String s5 = "AS"; + s5 += "D"; + System.out.println(s4 == s5); // true? (SP) + System.out.println(s4.equals(s5)); // (true) + + System.out.println("Done!"); } diff --git a/src/lab4/Main.java b/src/lab4/Main.java new file mode 100644 index 0000000..2e69f00 --- /dev/null +++ b/src/lab4/Main.java @@ -0,0 +1,7 @@ +package lab4; + +public class Main { + public static void main(String[] args) { + //todo equals+hashcode + } +}