Comment Differences between Java and JavaScript

Source: Internet
Author: User

Today, when I was learning JavaScript annotations, what was the difference between comparing Java annotations? The following is a detailed comparison.

Comments for Java

Java is divided into 3 types of annotations when using annotations.

Single-line Comment: Add a symbol "//" before the content of the comment.

Multiline comment: Start with "/*" and End with "*/".

Document Comment: Start with "/**" and End With "*/".

For example:

Package com.zm.test;
/**
* This is a document comment
* @author ZM
*
*/
public class Test {
/*
* This is a multiline comment
* can include multi-line content OH
*/
public static void Main (string[] args) {
This is a single-line comment
System.out.println ("Hello world! ");
System.out.println ("Hello world!");
}
}

PS: commented code blocks are not executed while the program is running, and you can use the Javadoc tag to generate more detailed document information when using document annotations:

@author identify the author of the development of such modules

@version indicate the version of the module

@see reference steering, i.e. related topics

@param a description of a parameter in the method

@return Description of the return value of the method

@exception description of the exceptions that the method might throw

Comments for JavaScript

JavaScript is divided into 2 types of annotations when using annotations.

A single-line comment, with the symbol "//" before the content of the comment. For example:

<script type= "Text/javascript" >

document.write ("single-line comment using '//'"); I am the comment that the statement function outputs content in a Web page

</script>

Multiline comments, starting with "/*" and ending with "*/". For example:

<script type= "Text/javascript" >

document.write ("Multi-line Comment using/* Comment content */"); /* Multiline comments develop a good habit of writing notes * *

</script>

Summarize

From the above comparison, it is obvious that Java has a document comment, while the other 2 kinds of comments: single-line comments, multiline comments are the same as JavaScript.

Comment Differences between Java and JavaScript

Related Article

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.