Single and Multi Line Comments in Java


The comments are the statements that are not executed by the compiler and interpreter. It 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 a specific time.

1. Single Line comments are started by // and may be positioned after a statement on the same line, but not before.

    Example:
       //single line comment

2. Multi-Line comments are defined between /* and */. They can span multiple lines and may even been positioned between statements.

     Example:
       /*
       Multi
       Line
       Comment
       */

Source Code

//03 Single and Multi Line Comment in Java
import java.lang.*;
 
class comments
{
	public static void main(String args[])
	{
		System.out.println("Welcome To Tutor Joes");
		/*
		In publishing and graphic design, Lorem ipsum is a placeholder text commonly used to demonstrate the visual form of a document or a typeface without relying on meaningful content. Lorem ipsum may be used as a placeholder before final copy is available.
		*/
	}
}

Output

Welcome To Tutor Joes
To download raw file Click Here

Basic Programs