Код: Выделить всё
public class Main {
public static void main(String[] args) {
System.out.println("Hello" == "Hello"); // true
System.out.println(new String("Hello") == new String("Hello")); // false
}}
Подробнее здесь: https://stackoverflow.com/questions/796 ... new-string