The package is a measure to avoid name duplication when using multiple classes or interfaces, and simply by adding the Packages keyword to the program
Compile Syntax :
Javac-d. Helloword.java
-D: Represents the build directory, and the resulting directory is based on the definition of the package
.: Indicates that the current folder in which you are building
execution Syntax :
Java Org.common.demo01.HelloWord
=================================================//file Name : myexception_demo//------------------------- -----------------------------------------------------//author : commonpackage org.common.demo01;//Define a Package// Class Name: demo//property://Method: Class Demo{public String GetInfo () {return ' Helloword ';}} Main class//function : Hellowordpublic class Helloword {public static void main (string[] args) {//TODO auto-generated method Stub Demo Demo = New Demo (); System.out.println (Demo.getinfo ());}}
Import syntax
If several classes are stored in different packages, the class must be imported using the import statement
The concept and use of java--package