Home » , » Java Comments

Java Comments

Java Comments

Comments in Java allow you to describe the code. This makes the Java code easy to read. Whatever you add inside a comment never gets compiled. Comments in a Java program can be mentioned in the following two ways:

  • Single-line Comment
  • Multi-line Comments      

  Single-line comments

Use // i.e., two forward slashes for a single-line comment in Java. Whatever we mention after the slashes in a single line, will not get compiled.

Let us see an example displaying single-line comments in Java:




Output


Multi-line comments

For multi-line comments in Java, use /*     */. Whatever we mention under /* and */, will not get compiled.

Let us see an example displaying multi-line comments in Java:



Output

0 comments:

Post a Comment

Popular Posts

GENRES

 
Copyright ©

latest code update bloggingskillBest coding website in india

Created By Sora Templates | Distributed By Gooyaabi Templates