Computer Science, asked by varunkumar6485, 4 months ago

Name two types of comment and mention which symbol is used for these
comments

Answers

Answered by harneetmakkad27
2

Answer:

1. Single-line Comments

As the name suggests, it is for the beginners and is in a single line Java comments.

Syntax-

// A comment is written here

Example-

class Scomment

{

public static void main(String args[])

{

// Single line comment here

System.out.println("Single line comment above");

}

}

2. Multi-line Comments

Multi-line Java comments are used wherever we need to explain a procedure, single-line comments become tedious in this case as we will need to write ‘//’ at the start of every line.

Syntax-

/*Comment starts

continues

continues

.

.

.

Comment ends*/

Similar questions