aspose file tools*
The moose likes Beginning Java and the fly likes How List interface work ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How List interface work ?" Watch "How List interface work ?" New topic
Author

How List interface work ?

Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
hi, just wondering , how the List interface work ? i confuse as i know interface forced implemented class to write the method which declared in interface, my concern is

if we have following codes



as shown, how the "add" method from List interface work ? we didn't define the method..what is the hiding part behind ..

thank you very much for your time
[ July 26, 2004: Message edited by: Alvin chew ]
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9046
    
  10
ArrayList implements List and overrides the add() method.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
Marilyn, you meant ArrayList already define "add" method ?
Mani Ram
Ranch Hand

Joined: Mar 11, 2002
Posts: 1140
Originally posted by Alvin chew:
Marilyn, you meant ArrayList already define "add" method ?


Correct. ArrayList is a concreate class which implements the List interface and overrides the add() method(s).


Mani
Quaerendo Invenietis
Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
thank you , mani ...i clear now ....is it possible we can have a look on the code for ArrayList class ?
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Sure. Your JDK has a file called src.zip (or possibly src.jar) which contains the source code for most of the Java libraries. (Excluding native methods.) You can upen this with most any unzipping tool (including many file browsers, nowadays) or using

jar -xvf src.zip


"I'm not back." - Bill Harding, Twister
Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
thanks , jim ...try it now ....
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Alvin, you might like a read of the "How my Dog learned Polymorphism" story in the JavaRanch Campfire Stories.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
thank dirk , reading
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How List interface work ?