File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
JavaRanch » Java Forums » Java » Beginning Java
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: 10245
    
    8

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: http://aspose.com/file-tools
 
subject: interface probelm?