interface Block{
void printblock();
}
interface Block2{
void printblock();
}
class Impl2 implements Block,Block2{
@Override
public void printblock() {
// TODO Auto-generated method stub
System.out.println("Impl2");
}
}
public class Import
{
public static void main(String[] args) {
new Impl2().printblock();
}
}
現在請告訴我哪個printblock方法是通過類Import.Its實現Block接口或Block2接口來實現的嗎?java界面問題
反問:它會有什麼不同? – 2011-05-09 05:14:44
instanceof將爲這兩個接口返回true。 – 2011-05-09 06:05:07