Results 1 to 3 of 3
- 03-17-2012, 12:34 PM #1
Member
- Join Date
- Mar 2012
- Posts
- 4
- Rep Power
- 0
hi i am naive to java ,started learing java.and I have question "Interface does not"
contain any implementations.then what is the use of instantiating them?.For example in jdbc API Connection is an interface.then why do we create connection object .what exactly happens when connection interface is instantiated.can you please elaborate on it.I have been breaking my head over this.please help me with this
Thank you.
- 03-17-2012, 12:44 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,385
- Blog Entries
- 7
- Rep Power
- 17
Re: hi i am naive to java ,started learing java.and I have question "Interface does
As a matter of fact, you don't create a Connection object (you even can't do that), but you ask something else to create it; that something else creates an object of a class that implements the Connection interface. All you care about is that it implements the Connection interface; you don't care at all what class had delivered the object. It's the database vendor that is responsible for the details and it can change them at will as long as their object implements the Connection interface.
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 03-20-2012, 01:28 PM #3
Member
- Join Date
- Mar 2012
- Posts
- 4
- Rep Power
- 0
Similar Threads
-
Got struck with this :- " Exception in thread "main" java.lang.NullPointerException"
By Vermont in forum New To JavaReplies: 5Last Post: 12-21-2011, 06:44 PM -
Exception in thread "main" java.lang.NumberFormatException:input string: "060320
By renu in forum New To JavaReplies: 14Last Post: 04-08-2011, 06:01 PM -
Question about error "Exception in thread "main" java.lang.NoSuchMethodError: main
By ferdzz in forum New To JavaReplies: 5Last Post: 06-22-2010, 03:51 PM -
Java, Military Format using "/" and "%" Operator!!
By sk8rsam77 in forum New To JavaReplies: 11Last Post: 02-26-2010, 03:03 AM -
the dollar sign "$", prints like any other normal char in java like "a" or "*" ?
By lse123 in forum New To JavaReplies: 1Last Post: 10-20-2008, 07:35 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks