Thing in Java (Third edition) Reading abstract (1)

Source: Internet
Author: User

2005-03-22

Certificate --------------------------------------------------------------------------------------------------------------------------------------

1. The default value of a primitive member can be initialized only when "the variable is applied to a member of the class. "Local" variables-that is, variables of non-class data members, do not enjoy this guarantee. Therefore, if you define in the method:

Int X;

Then this X can be any value, and it will not automatically initialize to zero.

2. If a class member or method is a static member or method, you can use either the object call method or the class call method.

ProgramThe main method of the entry point uses this feature:

Public static void main (string [] ARGs ){

String S = new string ("hello ");

System. Out. println (s );

}

3. name visibility: Java uses the domain name method to resolve name conflicts. Generally, the domain name sun.com is used as a name such as package: COM. Sun. EJB. At the same time, the class name must be the same as the file name, and the directory structure must be the same as the package naming method.

4. Use import to introduce the class (Library) to be used, such as import java. util. arraylist or use wildcard (*) to introduce several classes at the same time, such as import java. util .*;

5. comment out the javadoc file in the following format:

/**

*/

There are two main types of usage: embedded HTML and document tag (Doc tags). Independent document comments are headers by some @ commands.

For example:

/**

* <PRE>

*

* </PRE>

*/

Tag example:

@ See: References other classes that allow you to reference other classes in the document. javadoc uses @ see to generate links to other HTML documents. The format is as follows:

@ See classname;

@ Fully-qualified-classname;

@ Fully-qualified-classname # method-name

Each line adds a See also hyperlink to the generated document. Note that javadoc does not check the validity of this hyperlink, so we must check it ourselves.

{@ Link package. class # member label}: similar to @ see, it only contains embedded document tags, and labels appear as hyperlink text rather than "See also.

{@ Docroot}: returns the relative path with the document directory as the root. Used to connect pages in the directory.

{@ Inheritdoc}: inherits the document of the base class closest to this class to the current document.

@ Version: Usage:

@ Version-Information

You can enter anything you think is appropriate in version-information. After javadoc is called using the-version parameter in the command line, the HTML document with version information can be generated.

@ Author: Usage:

@ Author-Information

Here, author-information should be your name, including the ermial address and other information. You can add multiple author tags, but they must be continuous. In an HTML file, all the author information is put together.

@ Since indicates the version from which the program provides certain features. In the Java HTML document, you will see that it represents the JDK version.

@ Param

Used for the annotation method. Its usage is:

@ Param parameter-Name Description

Parameter-name indicates the parameter list of the method, and description is a text segment that can be divided into several lines. Description is complete only when a new document mark is encountered.

@ Return

The annotation method is used to notify you of the returned value by @ return description.

@ Throws method:

@ Throws fully-qualified-class-name desciption, where fully-qualified-class-name must be the name of the exception known by the method, and description (there may be several lines) it will tell you why the method causes this exception.

@ Deprecated

This is used to indicate that a feature of the program has been updated and the improved feature is replaced. We recommend that you stop using the deprecate tag because this feature may be removed from the program in the future. When the client program uses the @ deprecated flag, the compiler reports a warning message.

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.