指出下面程序的运行结果
1 class A{ 2 static{ 3 System.out.println("1"); 4 } 5 public A(){ 6 System.out.println("2"); 7 } 8 } 9 10 class B extends A{ 11 static{ 12 System.out.println("a"); 13 } 14 public B(){ 15 System.out.println("b"); 16 } 17 } 18 public class Hello { 19 public static void main(String[] args){ 20 A ab = new B(); 21 ab = new B(); 22 } 23 }
posted on 2016-05-09 14:37 dangjunhui 阅读(476) 评论(1) 编辑 收藏 举报