In a Java source file, import statements occur immediately following the package statement and before class definitions.
This is the general form of the import statement:
import pkg1[.pkg2].(classname|*);
* means including all classes under that package. For example,
import java.lang.*;
Any place you use a class name, you can use its fully qualified name, which includes its full package hierarchy.
For example, this fragment uses an import statement:
import java.util.*;
class MyDate extends Date {
}
The same example without the import statement looks like this:
class MyDate extends java.util.Date {
}
java2s.com | Contact Us | Privacy Policy |
Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
All other trademarks are property of their respective owners. |