Hi, Remember when using a classpath, the last directory in the path must be the super-directory of the root directory for the package. When you use an import statement you are declaring only one package. When you say import java.util.*; you are saying "Use the short name for all of the classes in the java.util package." You�re NOT getting the java.util.jar classes or java.util.regex packages! Those packages are totally independent of each other; the only thing they share is the same "root" directory, but they are not the same packages. As a corollary, you can�t say import java.*; in the hopes of importing multiple packages �just remember, an import statement can import only a single package.
Can any one explain me the the meaning of above lines or can give me example. Thanks in advance.
SCJP1.5(81%), SCDJWS(94%), next mission SCEA (but need to wait or that)
root/ root/java/ java/util/ -Date.class // import java.util.Date -Calendar.class // import java.util.Calendar // both can be imported by import java.util.* java/util/regex/ -Pattern.class //import java.util.regex.Pattern //or import java.util.regex.* to import all under regex folder java/lang/
Note: import java.util.* will NOT import regex folder classes at all but just CLASSES (not subpackages) under util package/folder. [ August 07, 2007: Message edited by: ajay futuro ]