In JDBC connection we use different methods other than DriverManager class. All of them are Interfaces. 1. My question is then how do we call the methods of interfaces? 2. If the answer is it calls a class that implements these interface then which class is this?
Originally posted by Kousik Majumder: In JDBC connection we use different methods other than DriverManager class. All of them are Interfaces. 1. My question is then how do we call the methods of interfaces?
DriverManager uses the connection string to find a concrete class. This class is part of the database specific driver; the only real thing you can tell is that it implements Connection.
The thing is, you're not getting interfaces back from those methods. Instead, they return some concrete class that implements that interface. Because the methods specify to return an interface, the same code could be used with a different type of database; only the connection string needs to be modified.