以下代码输出结果为:
class Main { public static void main(String[] args) { String obj1 = new String("nowcoder"); String obj2 = new String("nowcoder"); if(obj1.hashCode() == obj2.hashCode()) System.out.println("object1 与 object2 哈希码相等"); if(obj1 == obj2) System.out.println("object1 与 object2 内存地址一样"); if(obj1.equals(obj2)) System.out.println("object1 与 object2 值相等"); } }