Java comments example : Using comments in java


Java comments are used in a program for documentation purpose. Comments give clarity to the source code and make it more understandable. Java comments are not programming statements are ignored by the java compiler. This is to help the programmers or users to communicate and understand the program.

Java supports the following type of comments,
  1. /*Some comment*/
  2. //Some other comment
  3. /** Documentation comment */


/*Some comment*/

This type of comment is used to place more than one sentence of statements in comment. Everything between the two delimiters is ignored by the compiler.

//Some comment

This is a single line comment. Any statement of sentence inline with “//” is considered as comment by the complier.

/**Documentations comment*/

This is used to indicate some special documentation comments. These comments are used to document the working of a class and its member functions works.

No comments:

Post a Comment