interface A {
  public void methodA();
}interface B extends A {
  public void methodA();
  public void methodB();
}class BB implements B {
  public void methodA(){}
  public void methodB(){}
}public class TestBB {
    public static void main(String[] args) {
        B myBB; // 接口B
        myBB = new BB();
        myBB.methodA(); // 通过从接口A继承的接口B调用methodA
        myBB.methodB(); // 通过从接口A继承的接口B调用methodB
    }
}

解决方案 »

  1.   

    dataSource 和 TreeNode 都是 API 中描述的interface, 也可以这样用么?
      

  2.   

    例如String吧,API中在Method summary后写了2行:Methods inherited from class java.lang.Object 
    clone, finalize, getClass, notify, notifyAll, wait, wait, wait 是什么意思?
    这几个Methods可以使用在String上么?比如说我想用method clone, 又如何使用呢?
      

  3.   

    clone方法是protected的,老大!!
      

  4.   

    getClass是public的,可以使用么?
      

  5.   

    hi man, i think you need read some basic things about Inheritance.Basicly every object in JAVA inherite from the class Object, and thats why you find the statement in java API.The public methods, protected methods are all available to the sub-class which inherite from the base-class.
      

  6.   

    正在看thinging in java, 也正在编些程序,争取在游泳中学会游泳.