java.util is one package, java.util.regex is another package. regex is a part of java.util as regex is its sub package(regex is created inside util). Its correct that regex is a part of util but as a different package. Thus when you import java.util, you import only java.util classes, not the classes of its sub packages. The same case is with java.util.jar
ayush raj wrote:
I could not understand the last line. When these jar and regex classes/package do belong to java.util package , how come they are not imported?
The last line is basically saying that they don't belong to the java.util package. When you import java.util.*, you get the classes from the java.util package. It doesn't recursively import the classes from the java.util.regex or java,util.jar package -- to do that, you need to import java.util.regex.* or java,util.jar.* respectively.