This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
sudheer kiran wrote:but how do we know Which concrete connection object that is
The idea is that you don't need to know and that makes your code more general and flexible.
Connection and Statement are interfaces. When you write your code using variables of an interface your code will work with any object implementing that interface. Otherwise your code would be tied down to work with objects of one concrete class only.
sudheer kiran wrote:DriverManager returns a Connection Object.but how do we know Which concrete connection object that is
That depends on the JDBC driver that you are using - it's a class that the JDBC driver provides. You're not supposed to know in your Java application, because you don't want to make your application dependent on one specific JDBC driver. If you really want to know, you can find out like this: