How to write comments in java

  • Comments are used to write the detailed description about application logics to understand the logics easily.
  • Comments are very important in real time because today we are developing the application but that application maintained by some other person so to understand the logics by everyone writes the comments.
  • Comments are non-executable code these are ignored at compile time.

There are 3 types of comments.

Single line Comments:-

By using single line comments it is possible to write the description about our programming logics within a single line & these comments are Starts with // (double slash) symbol.

Syntax:-       //description

Multi line Comments:-

This comment is used to provide description about our program in more than one line & these commands are start with /* & ends with */

Syntax: –       /*—-satement-1

—-statement-2

*/

Documentation Comments:-

By using documentation comments it possible to prepare API(Application programming interface) documents.(e will discuss later chapte)

Syntax: – 

   /*

*statement-1

*statement-2

*/

Published by Atul maurya

i am student of computer science & engineering .i want to become a java developer. my hobby is to learn programming language in easy way.

Leave a comment

Design a site like this with WordPress.com
Get started