如题,面试题如下:
请输入下面代码的运行结果--------extends-----------
class HelloA { public HelloA(){ System.out.println("HelloA"); } {System.out.println("I'm A class");} static{System.out.println("static A");} }
public class HelloB extends HelloA{ public HelloB(){ System.out.println("HelloB"); } {System.out.println("I'm B class");} static{System.out.println("static B");} public static void main(String[] args) { new HelloB(); } }
</pre><pre name="code" class="java">static A static B I'm A class HelloA I'm B class HelloB
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文地址:http://blog.csdn.net/s2940086379/article/details/46711387