Java 4android video learning notes-package and access permissions (1). You are not authorized to access the notebooks.
How to package? The Code is as follows:
Package org. marsdroid;
Class Test
{
Public static void main (String args []) {
System. out. println ("Hello package ");
}
}
Note the following points for packaging:
1. The Compiling Method of the packaged class is different. The-d parameter is used to generate a folder Based on the package name. And-d is followed by the Directory, "." represents the current directory. For example, compile the above class, it should be
Javac-d. Test. java. If you want to put this class in the windows folder on drive C, it should be javac-d C: \ windows Test. java;
2. After packaging, the class name of this class has changed. Changed to "package name" + "." + "Class Name". during compilation, you cannot directly write javac Test. java, but javac org. marsdroid. Test. java;
3. Package name naming rules: 1) All letters of the package name must be in lowercase;
2) The package name is generally written by your domain name.
However, the rules are dead, and people are active.