OneBite.Dev - Coding blog in a bite size

create comments in java

Code snippet on how to create comments in java

  // This is an example of a single line comment
 
  /*
   This is an example of a 
   multi line comment
  */

This code sample demonstrates two types of comments in Java. The first line is an example of a single line comment. This type of comment is indicated by two forward slashes (//) and can only be used on one line. The second part of the code is an example of a multi-line comment. This type of comment starts with a forward slash and an asterisk (/) and ends with an asterisk and a forward slash (/). Everything between the start and end of the comment is ignored by the compiler and is used for the programmer to explain and document the code. This type of comment allows multiple lines and is useful for longer explanations.

java