aspose file tools
The moose likes Beginning Java and the fly likes interface probelm? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "interface probelm?" Watch "interface probelm?" New topic
Author

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;
Class.forName(driver);
con=DriverManager.getConnection("");



here how is possible?

Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 8439

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.


[Donate a pint, save a life!] [How to ask questions] [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: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: interface probelm?
 
Similar Threads
interface reference
interface's object
Interfaces
Connection con;
instantiating interface