Results 1 to 3 of 3
  1. #1
    REBEL is offline Member
    Join Date
    Mar 2012
    Posts
    4
    Rep Power
    0

    Lightbulb 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.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,371
    Blog Entries
    7
    Rep Power
    20

    Default Re: hi i am naive to java ,started learing java.and I have question "Interface does

    Quote Originally Posted by REBEL View Post
    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
    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,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    REBEL is offline Member
    Join Date
    Mar 2012
    Posts
    4
    Rep Power
    0

    Default Re: hi i am naive to java ,started learing java.and I have question "Interface does

    Thank you very much josah for your explanation.

Similar Threads

  1. Replies: 5
    Last Post: 12-21-2011, 06:44 PM
  2. Replies: 14
    Last Post: 04-08-2011, 06:01 PM
  3. Replies: 5
    Last Post: 06-22-2010, 03:51 PM
  4. Java, Military Format using "/" and "%" Operator!!
    By sk8rsam77 in forum New To Java
    Replies: 11
    Last Post: 02-26-2010, 03:03 AM
  5. Replies: 1
    Last Post: 10-20-2008, 07:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •