| Author |
jar files
|
ayush raj
Ranch Hand
Joined: Jan 15, 2012
Posts: 45
|
|
I was going through Kathy & Bert Bates book on SCJP . In the last lesson on JAR file , i found the following text :
"When you say import java.util.*;you are saying "Use the short names for all of the classes in java.util package". You are not getting the java.util.jar classes or the java.util.regex packages!"
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?
|
 |
Astha Sharma
Ranch Hand
Joined: Oct 15, 2011
Posts: 128
|
|
|
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
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 14611
|
|
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.
Henry
|
Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
|
 |
 |
|
|
subject: jar files
|
|
|