Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

interface probelm?

 
harsh garg
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11185
15
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
amitabh mehra
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can always assign object of child type into reference of parent type.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic