We Offer 100% Job Guarantee Courses (Any Degree / Diploma Candidates / Year GAP / Non-IT / Any Passed Outs). Placement Records
Hire Talent (HR):+91-9707 240 250

General

Java Comments

Java Comments

Java comments

Comments are set of statements that are used to explain about java program components. It is provide information and explanation about variables,methods, class or any other statements. So that other developers can understand the code and flow of execution by reading the comments. It is  not executed by compiler or interpreter.

Types of Comments

There are three types of comments

  • Single-line comment
  • Multi-line comment
  • Documentation comment

Single-line comment

// – It is single line comment

Example:

Class Add
{
Int a;//declaration of variable
}

Multi-line comment

/*

*/ – Multi-line comment. It is also used for single line also.

Example:

Class Add
{
Int a;/*declaration of variable*/
/*
This is function for add two numbers
*/
Public void add();
}

Documentation comment

/**

*

*/- Documentation Comment

/**

* This is program for print hello statement

*/

Example:

Class FirstProgram
{
Public static void main(String[] args)
{
System.out.println(“Hello”);
}
}

Click Here-> Get Java Training with Real-time Projects

Besant Technologies WhatsApp