- class A{
- public static void print(){
- System.out.println("A");
- }
- public A(){
- System.out.prinln("A");
- }
- }
- public class B extends A{
- public static void print(){
- System.out,.println("B");
- }
- public B(){
- System.out.println("B");
- }
- public static void main(String[] args){
- A a=new B();
- a=new A();
- }
- }
复制代码 说出输出结果是什么,why? |