写派生类的格式是什么?
我在书上看到一种格式:
(派生类名:基类名)
上面的格式对吗?谢谢

解决方案 »

  1.   


    public class Test{ 
      
      public int i = 0; 
      public void test(){ 
    System.out.println(this.getClass().getName());
        System.out.println(this.i); 
      } 
      public static void main(String[] args){ 
      Test a = new B(); 
      a.test();
      B b1=new B();
      b1.out();
      }
    }   class B extends Test{ //子类   public int i =1;  
      public void out(){
      System.out.println(this.i);
      System.out.println(super.i);
      }