0

I've started yesterday to use IntelliJ IDEA for java programming, before I was using Eclipse.

I've noticed that there are two types of comments that this software uses (excluding the classic //comment here):

  • /* comment here */ and it will be displayed in grey
  • /** comment here */ and it will be displayed in green

what is the difference between the two? when should I use one, when the other?

Daniele
  • 4,163
  • 7
  • 44
  • 95

1 Answers1

2
/*.....*/

If you want to comment out multiple line you need to use the multi line comment.

If you want to provide proper documentation to your methods/variables you need to use documentation comments. Since there is a tool which comes with jdk, which will create a documentation for your classes.

/**
* This method is used to ...
*/
e.g  public void method()
{
//your logic
}

Also you can use it for variable too.

/**
* This variable is used for ...
*/
private static int s=99;
Shriram
  • 4,343
  • 8
  • 37
  • 64