SCJP2. Please Indent your code using UBB Code
Originally posted by marilyn murphy:
Check out java.sql Interface Connection:
DriverManager.getConnection( "jdbc:mysql://urlToDatabase" );
returns a Connection object which can be any object that implements the interface Connection. We don't know which Connection object is returned by the vendor's implementation of this method. We don't [b]need to know in order to use it. Each vendor creates their own implementation using the methods defined in the Connection interface. So all you need to do is fill in the String which is given to you by the vendor and the method works. If you change from mysql to MS SQL server, all you need to do is change the string and the method still works fine, even though the implementation of the methods defined by Connection by the new vendor may be (and probably are) completely different. Polymorphism at its best.
They gave me pumpkin ice cream. It was not pumpkin pie ice cream. Wiping my tongue on this tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!https://www.kickstarter.com/projects/paulwheaton/low-tech