您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
三六零分类信息网 > 赤峰分类信息网,免费分类信息发布

java静态和动态绑定怎么实现

2025/10/25 9:33:08发布32次查看
不同绑定的比较
1、静态绑定发生在编译期,动态绑定发生在运行期。
2、动态绑定的灵活性高于静态绑定,因为静态绑定是在编译过程中确定的,动态绑定在编译过程中不知道调用哪种方法。
3、静态绑定调用方法比动态绑定快,因为静态绑定可以直接调用,动态绑定需要搜索方法表。
实例
静态绑定
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() } }
(2)动态绑定
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() } }
以上就是java静态和动态绑定怎么实现的详细内容。
赤峰分类信息网,免费分类信息发布

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product