A Developer Gateway To IT World...

Techie Uncle Software Testing Core Java Java Spring C Programming Operating System HTML 5 Java 8 ES6 Project

Comments in Java

What are the comments in Java?

How to comment code in Java?

Java supports single line and multi-line comments very similar to c and c++. All characters available inside any comment are ignored by Java compiler.







public class MyFirstJavaProgram
{
 
 /* This is my first java program. This will print 'Hello World' as the output. This is an example of multi-line comments. */
 public static void main(String []args)
 {
  
  // This is an example of single line comment
  /* This is also an example of single line comment.*/ 
  System.out.println("Hello World");
 }
}


 


Using Blank Lines:
A line containing only whitespace, possibly with a comment, is known as a blank line, and Java totally ignores it.

LEARN TUTORIALS

.

.