Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Interfaces

 
siddu banjapally
Greenhorn
Posts: 13
Chrome Java Tomcat Server
  • Mark post as helpful
  • send pies
  • 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
 
Tina Smith
Ranch Hand
Posts: 208
9
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • 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
Chrome Java Tomcat Server
  • Mark post as helpful
  • send pies
  • 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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic