package com.fy.day12.test;
public class TestSuperKeyword {
public static void main(String[] args) {
B b = new B();
b.upload();
}
}
class A {
int n = 10;
}
class B extends A {
int n = 20;
public void upload() {
int n = 30;
System.out.println(n);
System.out.println(this.n);
System.out.println(super.n);
}
}
//输出结果:30 20 10
super访问属性
最新推荐文章于 2023-03-30 22:31:45 发布