equals()方法在根类Object中确实是比较地址值,也就是看两个引用变量是否指向同一个对象。API文档原话: this method returns true if and only if x and y refer to the same object (x == y has the value true)
但是,子类继承父类时可以重写父类的方法啊。String类作为Object的子类就重写了继承自Object的equals()方法,把相等判定条件改成两个字符串有相同的字符序列。API文档:The result is true if and only if the argument is not null and is a String object that represents the same sequence of characters as this object. 所以s1.equals(s2)返回true