9. Selenium Tutorial - II. Java for Selenium - 7. Comments in Java

preview_player
Показать описание
Comments in Java, writing comments in Java programs, Java single line comments, Java multi-line comments, and Java documentation comments.

1. Purpose of Comments

The Java comments are the statements that are not executed by the compiler and interpreter.

The comments can be used to provide information or explanation about the variable, method, class, or any statement.

The comments can be used to hide program code.

Note: The primary purpose of comments is to make the code understandable and the secondary purpose of comments is to make the code prevent execution.

2. Comments Syntax in Java

In Java there are three types of comments:

a. Single – line comments.
b. Multiline comments.
c. Documentation comments.

a. Use // for Single line comment

b. Use /*………….
…………………
…………………
………………*/ for Multiple line comment

Or

c. Documentation Comments

This type of comments are used generally when writing code for a project/software package since it helps to generate a documentation page for reference.

Syntax:

/**Comment start
.............
..............
*
*comment ends*/

4. Usage of Comments in Test Automation

a. To Write Test case header

b. To Write Method header

c. To Explain Complex Logic
Рекомендации по теме
visit shbcf.ru