Showing posts with label Single Line Comment. Show all posts
Showing posts with label Single Line Comment. Show all posts

Monday, August 17, 2015

Java Comments

Hi All...!

This post is about Java Comments, commenting makes your code easy to read and easy to understand, The Java compiler ignores comments, so they do not cause the computer to perform any action when the program is run.

There are two types of Java comments commonly in use among Java programmers,

1) Single Line Comment

Single line comments begins with two forward slashes  "//".

Following example shows how to use Java single line comments in source code.





Let's take a look at what will happen when we compile and run this commented code.





That code runs normally, as I told you earlier Java compiler simply ignores comments.


2) Traditional Comment (Multiple Lines Comment)

This traditional comments begins with the forward slash and asterix symbol and ends with asterix symbol and forward slash.

Let's take a look how to use this multiple line comments in Java program


Let's compile and run that program,


It's run normally because compiler ignores comments.