Multi Line Comment in java

Java Programming Language / Overview of Java Language

3415

The java comments are 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. It can also be used to hide program code for specific time.

Types of Java Comments

There are 3 types of comments in java.

  1. Single Line Comment
  2. Multi Line Comment
  3. Documentation Comment

Java Multi Line Comment

The multi line comment is used to comment multiple lines of code.

 
/* 
This
is
multi line
comment
*/

Program:

public class MultiLineComment {

public static void main(String[] args) {
/* it's a multiline comment, we are going
declare and  print variable in java. */
    int j=10;
    System.out.println(j);
 }
}

Output:

10
Press any key to continue . . .

Explanation:

Another Example

public class CommentExample2 {  
public static void main(String[] args) {  
/* Let's declare and 
 print variable in java. */  
    int i=10;  
    System.out.println(i);  
}  
}  

This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.