Java Comments


Comments in Java programming language are like helping text in our program and they are ignored by the compiler and interpreter. It can also be used to hide program code for a specific time.

Types of Java Comments
There are three types of comments in java programming language:

Java Comments
Java Comments

1. Single-Line Comments
2. Multi-Line Comments
3. Documentation Comments

1. Single-Line Comments
The single line comments are used to comment only one line. The single-line comment starts with two forward slashes (//).
Syntax: //This is a single line comment

2. Multi-Line Comments
Multi-line comments are used to enter a paragraph or strings. A multi-line comment is used to describe a full method in a code/program. Multi-line comments start with /* symbol and end with */ symbol.
Syntax:
/*
This
is
a
multi-line
comment
*/

3. Documentation Comments
The Documentation comments are used generally when writing code for a project, since it helps to generate a documentation page for reference, which can be used for getting information about method present, its parameters, etc.
The documentation comments are used to create documentation API. To create documentation API, we need to use javadoc tool.
Syntax:
/**Comment start
*
*This is a documentation comment
*
*comment ends
*/




Post a Comment

3 Comments

  1. Thanks for your information, it was really very helpfull..
    java代做

    ReplyDelete
  2. This is a wonderful article, Given so much info in it, These type of articles keeps the users interest in the website, and keep on sharing more ... good luck 统计学补习

    ReplyDelete
  3. Thank you because you have been willing to share information with us. we will always appreciate all you have done here because I know you are very concerned with our. HTML Tutorial

    ReplyDelete