Java中的动态绑定是什么?
在动态绑定中,方法调用在运行时绑定到方法主体。这也称为后期绑定。这是使用实例方法完成的。
示例
class Super {
public void sample() {
System.out.println("This is the method of super class");
}
}
Public class extends Super {
Public static void sample() {
System.out.println("This is the method of sub class");
}
Public static void main(String args[]) {
new Sub().sample()
}
}输出结果
This is the method of sub class
热门推荐
10 娶嫂子的祝福语简短
11 三十三句祝福语简短
12 祝福语签名简短大全女生
13 祝美术老师祝福语简短
14 生日牌祝福语英语简短
15 男生打球祝福语简短霸气
16 学生祝福语简短古诗大全
17 恭贺新婚文案祝福语简短
18 朋友花篮开业祝福语简短