Java basics 007-Package

Source: Internet
Author: User

Java basics 007-Package

Learning Java at the age of 35

Package 1.1 (Package) 1) manages class files by category. 2) provide multiple namespace for the class. 3) Write it in the first line of the program file. 4) The full name of the class name is the package name. Class Name. 5) package is also a form of encapsulation.

 

1.2 classpath1) an environment variable provided to JVM. 2) Specify the path of the class or package. 3) The last semicolon of the classpath variable value is different from that without a semicolon.

 

Access between 1.3 Packages 1) the class permission in the accessed package must be public. 2) member permission in the class: public or protected3) protected is a permission provided for the subclass in other packages.

 

1.4 four Permissions

 

1.5 import1) simplified class name. 2) There is only one package in a program file and there can be multiple imports. 3) it is used to export classes in the package and does not import packages in the package. 4) usually write import mypack. Demo; 5) instead of importmypack. *; why? What to import!

 

1.6jar package Java compressed package is convenient for the project to carry. For ease of use, you only need to set the jar path in classpath. Database drivers and SSH frameworks are all embodied in jar packages.

 

The operations of 1.7jarpackage allow the operations of jar.exe on jar. Create a jar package: jar-CVF mypack. jar PACKA packb: jar-tvf mypack. jar [> targeted file] decompress: jar-xvf mypack. jar custom jar package configuration file: jar-cvfm mypack. jar mf.txt PACKA packb

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.