• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Interfaces

 
Greenhorn
Posts: 13
Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello everyone,


I am working with JDBC program.when i come across code, I got some doubts.

that is, we can not create object for interfaces, then in JDBC connection, statement,etc having objects in program.


how can it possible?

thank you
 
Ranch Hand
Posts: 208
9
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you have an example of something that you don't understand?

Interfaces are (and I use that loosely) objects. I like to think of them as another way of looking at an object, in terms of what it does. An interface describes the behaviour contract of an underlying object. Any object that can fill this contract can be used.
Example is ResultSet; you know that there is an object there and that you can call the next() method to get a result. The only thing you don't know is the name of the class that is responsible for providing the result returned by next().
 
siddu banjapally
Greenhorn
Posts: 13
Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Connetion con=DriverManager.getConnection(,,);
Statement stmt=con.createStatement();

In the above code, Statement is a interface, so we can create only reference, not object and there con is a connection interface object.


how they create the objects for them and accessing the variables?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic