upd lab3 // add todo for lab4

This commit is contained in:
Oleksii Aleshchenko 2023-04-13 16:07:52 +03:00
parent 4531049ff2
commit 1690d0f9e4
2 changed files with 19 additions and 2 deletions

View File

@ -1,6 +1,11 @@
public class Lab3 { public class Lab3 {
public static void main(String[] args) { public static void main(String[] args) {
String s = "ASD"; String s = "ASD";
StringBuilder stringBuilder = new StringBuilder("ASD");
stringBuilder.append("A");
String s2 = s; String s2 = s;
System.out.println("s2 = " + s2); System.out.println("s2 = " + s2);
System.out.println(s == s2); // true? System.out.println(s == s2); // true?
@ -18,8 +23,13 @@ public class Lab3 {
// String Pool // String Pool
String s4 = "ASD"; String s4 = "ASD";
System.out.println(s4 == s2); // true? // String s5 = new String("ASD");
System.out.println(s4.equals(s2)); // (true) String s5 = "AS";
s5 += "D";
System.out.println(s4 == s5); // true? (SP)
System.out.println(s4.equals(s5)); // (true)
System.out.println("Done!"); System.out.println("Done!");
} }

7
src/lab4/Main.java Normal file
View File

@ -0,0 +1,7 @@
package lab4;
public class Main {
public static void main(String[] args) {
//todo equals+hashcode
}
}