• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calling a method on Connection interface

 
Nischal Tanna
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,
I have a small query worth mentioning in this forumn.

We all know Connection (java.sql) is an interface. Then how can we call a method like close() on an interface reference. I mean where are these methods being referred from..Any1 knowing the reason for the same kindly help me...


Thanks & Regards,
Nischal
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We can do this because we are actually calling a method against the interface implementation not the interface direct. The implementation of the Connection interface is part of the JDBC driver you are using.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic