interface Operation
{
void insert();
void delete();
}
class JDBC implements Operation
{
public void insert()
{
System.out.println("JDBC的插入");
}
public void delete()
{
System.out.println("JDBC的删除");
}
}
class Hebirate implements Operation
{
public void insert()
{
System.out.println("Hebirate的插入");
}
public void delete()
{
System.out.println("Hebirate的删除。");
}
}
class DataBaseOperation
{
public static void main(String[] args)
{
Operation op=new Hebirate(); //通过接口,当我们更改操作类型时候,直接Operation op=new JDBC();即可,提高扩展性
op.insert();
op.delete();
}
}