为什么这里的 super 引用的地址与引用变量 sc1 引用的地址相同?

Why is super here referencing to the same address as referenced by reference variable sc1?

super 是不是应该引用未在此处创建的 Object class 类型的对象?

   public class SuperChk
    {
        void test()
        {
            System.out.println(super.toString());
        }
        public static void main(String[] args)
        {
            SuperChk sc1 = new SuperChk();
            System.out.println(sc1);
            sc1.test();
        }
    }

每个 Java class 都隐式继承自 Object。所以你调用了 toString 定义的方法 Object 并被你的 class.

继承

Isn't super suppose to refer object of Object class type which is not created here?

错误...不。

super 关键字(当这样使用时)表示 "want to refer to this, but viewed as an instance of its superclass"。这是 subclass 调用 superclass 中的方法的方式,它可能已被覆盖。

java.lang.Objectclass是所有引用类型的终极超class,你的SuperChkclass也不例外。您的 SuperChk class 有 toString() 方法(继承自 Object)并且 super.toString() 正在调用它。

现在在您的示例中,super. 是多余的,因为 SuperChk 不会覆盖字符串。但这里有一个例子,它不是多余的......

public class SuperChk {
    private void test() {
        System.out.println(toString());
        System.out.println(super.toString());
    }

    @Override
    public String toString() {
        return "Hello world";
    }

    public static void main(String[] args) {
        SuperChk sc1 = new SuperChk();
        sc1.test();
    }
}

如果你编译 运行 那,你会看到 toString()super.toString() 正在调用不同的方法。