Java Introductory Concepts Package and import analysis of personal understanding _java

Source: Internet
Author: User

Because of the recent learning of Java, encountered some of the concept of C + +, will it be recorded, to review their use, if there is no good understanding of the place, I hope everyone criticized the guide. Information from the Internet through their own integration to understand, if there is infringement please notify me will be deleted.

I'll start with package and import.

Package role is in fact the role of C + + namespace, to prevent the same name of the class conflict, but the implementation of the mechanism is not the same, the Java compiler at compile-time, directly based on the information specified package directly to the corresponding directory generated class files. such as the package AAA.BBB.CCC compiler generates the various classes under the. java file into the./aaa/bbb/ccc/directory.

With the package mechanism, resulting in the use of different types of time is very troublesome (refers to the writing code need to write longer), so the great God to find a way to lazy, so there is the import mechanism. Assuming that. A class under/aaa/bbb/ccc/, if there is no import mechanism we need how to instantiate a class, New AAA.BBB.CCC.A (), after using import AAA.BBB.CCC.A, we can directly use new A (), That is, the compiler helped us to match and extend the AAA.BBB.CCC. This string of strings, so it's just about compiling speed, but not particularly large items that are definitely negligible.

The above introduction to the Java concept of personal understanding of the package and import is a small series to share all the content, hope to give you a reference, but also hope that we support the cloud habitat community.

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.