Re: Interface question
From: Ryan Stewart (zaphod_at_no.texas.spam.net)
Date: 12/30/03
- Next message: Rick DeBay: "Re: Version control and bug tracking systems"
- Previous message: Chris Smith: "Re: Confused about java threading/sleeping"
- In reply to: Matt Humphrey: "Re: Interface question"
- Next in thread: Joona I Palaste: "Re: Interface question"
- Reply: Joona I Palaste: "Re: Interface question"
- Reply: Jorn W. Janneck: "Re: Interface question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 30 Dec 2003 16:13:36 -0600
"Matt Humphrey" <matthNOSPAM@iviz.com> wrote in message
news:ishIb.8809$Vv2.3917727@news1.news.adelphia.net...
>
> "ms" <msmsmsms782@hotmail.com> wrote in message
> news:cbb08f30.0312300616.52213f27@posting.google.com...
> > As a Java newbie this is perhaps a simple question for this group.
> >
> > I understand how Java interfaces work and that they don't have an
> > implementation. What I don't therefore understand is how some
> > interfaces in Java API (such as the ResultSet) can have an
> > implementation.
>
> As you have noted, the definition of an interface is not itself an
> implementation. However, other classes subsequently fulfill the contract
of
> the interface by implementing the methods. The key advantage is that
> numerous other totally disparate classes can fulfill the same interface
and
> thereby be treated as the same kind of object.
>
> Cheers,
> Matt Humphrey matth@ivizNOSPAM.com http://www.iviz.com/
This is something I've wondered about in the past. In the java.sql package,
Driver, Connection, Statement, and ResultSet are all interfaces. However, a
Driver returns a Connection, a Connection returns a Statement, and a
Statement returns a ResultSet. After reading through the DriverManager
source, it appears to me that a "driver" must be supplied externally, and
this driver package (jar?) would have to have classes that implement all
these interfaces plus the others in java.sql (Struct, PreparedStatement,
Blob, etc). It would be those classes that do the actual work. That makes
sense as it would allow individual vendors to write everything specifically
to work with their database, which is what a driver is in the first place.
Is there anyone here with more experience that could confirm or correct this
speculation?
-- Ryan Stewart, A1C USAF 805 CSPTS/SCBE
- Next message: Rick DeBay: "Re: Version control and bug tracking systems"
- Previous message: Chris Smith: "Re: Confused about java threading/sleeping"
- In reply to: Matt Humphrey: "Re: Interface question"
- Next in thread: Joona I Palaste: "Re: Interface question"
- Reply: Joona I Palaste: "Re: Interface question"
- Reply: Jorn W. Janneck: "Re: Interface question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|