First, it cannot be created.In eclipse, the package-info file cannot be created at will. The "type name is notvalid" error is reported, and the class name is invalid. The Java variable definition specification is: letters, numbers, and underscores, there is also the less commonly used $ symbol (by the way, Java is a variable that supports Chinese names. If you are used to the challenge, you can try and share your experience in this area ), how can I create this file?
It's easy to use NotePad to create one, copy it, and then change it. The more direct way is to copy one from another project, which is more convenient.
Second, the service objects are very special.A class is the description of a class or a group of things. For example, the dog class describes wangcai. What is the description of the package-Info class? It always has an object to be described or presented. It isDescribe and record the package information.
Finally, the class cannot have public or private access permissions.Package-info.java how special, is also a class file, will be compiled into a package-info.class, but in the package-info.java can only declare the default access to the class, that is, friendly class.
In fact, there are several special aspects, such as the inability to inherit, the absence of interfaces, and the absence of inter-class relationships (associations, combinations, and aggregation.
The particularity of this file is over. Let's talk about its role. It has three roles:
1. Facilitate Annotation on the package;
2. Declare friendly classes and package constants;
3. Provide an overall description of the package.
1 ./**
* <B> package-info is not a common class and has three functions: </B> <br>
* 1. Convenience of Annotation on the package; <br>
* 2. Declare the private class and constant of the package. <br>
* 3. Provide an overall description of the package. <Br>
*/
Package com. Company;