class Super { 
public Integer getLenght() 
{ return new Integer(3); } 
 } 
  
 public class Test extends Super 
 { 
 public Long Get() { return new Long(5); } 
  
 public static void main(String[] args) { 
 Super sooper = new Super(); 
Test sub = new Test(); 
System.out.println( 
 sooper.getLenght().toString() + ";" + 
 sub.getLenght().toString() ); 
 }
 }

解决方案 »

  1.   

    因为你没有重载父类的方法,如果你在Test中再写一个函数getLength()就可以调用子类Test中的这个方法了.
      

  2.   

    class Super { 
    public Integer getLenght() 
    { return new Integer(3); } 
     } 
      
     public class Test extends Super 
     { 
     public Long Get() { return new Long(5); }//此处函数名为Get  !!!!! 
      
     public static void main(String[] args) { 
     Super sooper = new Super(); 
    Test sub = new Test(); 
    System.out.println( 
     sooper.getLenght().toString() + ";" + 
     sub.getLenght().toString() ); //此处调用的是getLength !!!!!!
     }
     }只有父类里面有getLength函数啊,子类没有,怎么调用子类的呢??????
      

  3.   

    因为 getLenght()方法
     只有一个,而且在父类里面。
      

  4.   

    看看Java中的overwrite和overload是怎么定义的吧!