How JDBC implementation works

前端 未结 4 1915
情深已故
情深已故 2021-01-13 03:11

In JDBC, I see that Connection is an interface, which defines methods for interacting with Database.

I also know that interface contains only abstract m

4条回答
  •  不知归路
    2021-01-13 03:35

    An interface reference can point to any object of a class that implements this interface
    i.e. see the example below:

    interface Foo{
    void display();
    }
    
    public class TestFoo implements Foo{
    
    void display(){
    System.out.println(“Hello World”);
    }
    
    public static void main(String[] args){
    Foo foo = new TestFoo();
    foo.display();
    }
    
    }
    

提交回复
热议问题