标签:
应为static方法属于类,不属于对象而final方法覆盖
public class AA { static void f(){ System.out.println("bceeijAA"); } } public class BB extends AA { static void f(){ System.out.println("jingtaiBB"); } public static void main(String[] args) { System.out.println("BB的输出"); BB bb = new BB();//输出<span style="font-family: Arial, Helvetica, sans-serif;">jingtaiBB</span> //AA bb = new BB();//输出<span style="font-family: Arial, Helvetica, sans-serif;">bceeijAA</span> bb.f(); } }
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:
原文地址:http://blog.csdn.net/dst111188/article/details/46830717