public class Solution {


  public static void main(String[] args) {
    String a = new String("he")+new String("llo");
    System.out.println(a == a.intern());
    String b = "hello";
    System.out.println(a == b);
    System.out.println(a == "hello");
    System.out.println(b == "hello");
  }
}

true
true
true
true