我在這種情況下有一個疑問定製的實現,我已經張貼在這裏的一些示例代碼....的接口方法
public interface a{
public void m1();
public void m2();
public void m3();
.
.
.
public void m100();
}
public class A implements a{
public void m3(){
// implementation code
}
// Here i need to implement only m3() method but not all 100 methods
//basically i have to implement all the other 99 methods
// but here i don't want to either implement or provide skeleton declarations for all
//remaining.... what should i do for compiling this ????
}
誰能幫助呢?
這正是MouseAdapter,WindowAdapter等爲Swing中相應的MouseListener,WindowListener接口所做的事情。 – Rhangaun 2010-05-27 18:17:09
我在一次採訪中遇到了這個問題...... – Renuka 2010-05-27 18:19:51
@Renuka面試官想知道,如果你理解了界面和抽象類的區別,以及如何一起使用它們。 – zengr 2010-05-27 18:44:08