equals public class Main { public static void main(String[] args) { // equals String a = "hello"; String b = "java"; String c = "hello"; System.out.println(a.equals(b)); System.out.println(a.equals(c)); } } public class Main { public static void main(String[] args) { // equals String a = "hello"; String b = new String("hello"); System.out.println(a.equals(b)); System.out.println(a == b); } }