單項選擇題
class BitStuff {
BitStuff go() { System.out.print("bits "); return this; }
}
class MoreBits extends BitStuff {
MoreBits go() { System.out.print("more "); return this; }
public static void main(String [] args) {
BitStuff [] bs = {new BitStuff(), new MoreBits()};
for( BitStuff b : bs)
b.go();
}
}
結(jié)果為:()