File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes interface probelm? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "interface probelm?" Watch "interface probelm?" New topic

interface probelm?

harsh garg
Ranch Hand

Joined: Jul 13, 2008
Posts: 33
we all know we cannot create the object for the interface,But during the database connectivity , we create the object for the interface...

Connection con;
Statement st;

here how is possible?

Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10770

Same way we can create

Actually what you are creating (by calling new) is a HashSet type of object, but since it is of the type Set, the above statement is legal.

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
amitabh mehra
Ranch Hand

Joined: Dec 05, 2006
Posts: 98
You can always assign object of child type into reference of parent type.
I agree. Here's the link:
subject: interface probelm?
It's not a secret anymore!