Java 4android video learning notes-package and access permissions (1). You are not authorized to access the notebooks.

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.