Java中的静态绑定是什么?
在静态绑定中,方法调用在编译时与方法主体绑定。这也称为早期绑定。这是使用静态,私有和最终方法完成的。
示例
class Super {
public static void sample() {
System.out.println("This is the method of super class");
}
}
Public class Sub extends Super {
Public static void sample() {
System.out.println("This is the method of sub class");
}
Public static void main(String args[]) {
Sub.sample()
}
}输出结果
This is the method of sub class
热门推荐
10 新年发给客户祝福语简短
11 生日祝福语简短明了 同事
12 收围巾的祝福语简短
13 租房明天搬家祝福语简短
14 给儿子生日祝福语 简短
15 升职祝福语朋友简短精辟
16 儿子31岁祝福语简短
17 牛年佛家祝福语大全简短
18 日常祝福语简短语客户