FrameDemo2
//测试
package cn.itcast;
//user_gongneng
/*问题:接口(方法太多)——实现类(仅使用一个,也必须把所有方法实现,哪怕是空实现)
* 解决方案:
* 接口(方法较多)——适配器类(实现接口,仅仅空实现)——实现类(用那个重写那个)
*/
public class FrameDemo2 {
public static void main(String[] args) {
gongneng2 g =new gongneng2();
g.add();
}
}
//接口
package cn.itcast;
public interface user2 {
public abstract void add();
public abstract void delet();
public abstract void update();
public abstract void find();
}
public abstract void add();
public abstract void delet();
public abstract void update();
public abstract void find();
}
//实现
package cn.itcast;
public class gongneng2 implements user2 {
@Override
public void add() {
// TODO Auto-generated method stub
System.out.println("增加功能");
}
public void add() {
// TODO Auto-generated method stub
System.out.println("增加功能");
}
@Override
public void update() {
// TODO Auto-generated method stub
public void update() {
// TODO Auto-generated method stub
}
@Override
public void find() {
// TODO Auto-generated method stub
public void find() {
// TODO Auto-generated method stub
}
@Override
public void delet() {
// TODO Auto-generated method stub
}
public void delet() {
// TODO Auto-generated method stub
}
}