String a = new String("hello"); String b = new String("hello"); if(a.equals(b)) { System.out.println("a and b contain the same string."); }