The following notes are based on video series: 手把手教你用Java基础教程 - 北京尚学堂 - 马士兵
package
& import
are used to resolve repeated class names.
package
- Declare what package the class(es) belongs to.
- Declared at 1st line in java:
1 | package pk1.pk2.pk3; |
- If none
package
line —> nameless package . - Java manages packages by directory. For instance, the above .java will located at
./pk1/pk2/pk3
.
import
1 | //specific class |
JDK main packages
java.lang
: String, Math, Integer, System, Thread (default import)java.awt
: abstract window toolkitsjava.applet
java.net
jave.io
java.util
1 | jar -cvf xx.jar *.* |