HEAD FIRST这系列的书,真的让人产生阅读的快感~~:)

和那套明日科技的一样,。。

interface Nose {
    public int iMethod();
}

abstract class Picasso implements Nose {
    public int iMethod() {
        return 7;
    }
}

class Clowns extends Picasso {

    //pass
}

class Acts extends Picasso {
    public int iMethod() {
        return 5;
    }
}
public class DotComBust extends Clowns {
    public static void main(String [] args) {
        Nose [] i = new Nose [3];
        i[0] = new Acts();
        i[1] = new Clowns();
        i[2] = new DotComBust();
        for (int x = 0; x < 3; x++) {
            System.out.println(i[x].iMethod() + " " + i[x].getClass());
        }
    }

}

JAVA抽象类,接口,多态,抽象方法,一次列举-LMLPHP

JAVA抽象类,接口,多态,抽象方法,一次列举-LMLPHP

04-26 00:21