Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interface vs Class

807599Jan 8 2007 — edited Jan 8 2007
I have read about the difference between Java Interfaces and Classes and understand it to a reasonable degree.

What is confusing me is the following. How come java.sql.Connection is an Interface? I ask this because I can create a Connection object then call any of the methods from the interface.

example:

cstmt = connection.prepareCall("{CALL Master.."+strStoredProcedure+"(?,?,?,?,?,?,?,?,?)}");

prepareCall is a method in the Connection interface. By definition an interface only declares methods but does not implement them. The above example leads me to believe that the java.sql.Connection interface has implemented the prepareCall method because the class that contains the example statement does not implement the Conenction interfact but just uses the methods in calls.

Thanks for any help in clarifying my understanding.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 5 2007
Added on Jan 8 2007
3 comments
188 views