posted 18 years ago
Hi,
Welcome to JavaRanch!
Nothing magic about it. Vector has an array member in which it keeps the element data, and a count of elements. It tries to keep the array a little larger than needed, so growing by a few elements just involves using some of that extra space and incrementing the counter. When the Vector runs out of extra space, it allocates a new, larger array, and copies the old data into it.
The source code for all the JDK API classes (which, in general, is well-documented and easy to read) is part of the JDK download. Look for JAVA_HOME/src.jar to see if you've already got it installed.