This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Interfaces Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Interfaces" Watch "Interfaces" New topic
Author

Interfaces

siddu banjapally
Greenhorn

Joined: Aug 16, 2011
Posts: 13

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

Joined: Jul 21, 2011
Posts: 171
    
    5

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().


Everything is theoretically impossible, until it is done. ~Robert A. Heinlein
siddu banjapally
Greenhorn

Joined: Aug 16, 2011
Posts: 13

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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Interfaces
 
Similar Threads
Calling Interface uder different package.
Where is the implemetation for methods in HttpServletRequest & HttpServletResponse
interfaces
Does Bridge design pattern looks like interface in Java?
Spring JDBC?