When I want to write a program with StringTokenizer (for example) and write 'import java.util.*;' near the top of my file, is the compiler including *everything* from java.util or does it just choose what has been mentioned in the code?
The import statement does not do any "including". It is a (very) convenient way for the compiler to find classes that are required when compiling your class. It also cuts down on a lot of typing. For example, if you choose to not use an import statement for the StringTokenizer class, you would have to qualify the package name of the class every time you use it in your code:
The '*' in java.util.* means import all classes in the java.util package. Again, the '*' is a wildcard used for convenience. If you were using more than one class from the java.util package, you would have to specify more than one import statement for each class you were using if you chose to not use a wildcard import.
Regards, JD [ April 07, 2005: Message edited by: John Dell'Oso ]
With other words, imports don't have any effect on class files, they just make writing java source code more convenient.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus