https://images.velog.io/images/dnjscksdn98/post/a4b88031-0fb7-4fb4-a363-40ce100e6881/string.png

String 객체를 생성하는 방식

1) new 연산자를 이용하는 방식

2) 리터럴을 이용하는 방식

public class Main {
  public static void main(String[] args) {
    String str1 = new String("hello");
    String str2 = "hello";
    String str3 = "hello";

    System.out.println(str1 == str2);  // false
    System.out.println(str2 == str3);  // true
  }
}