.png)
.
Java
Comments
/**
*project Name -Test
* Developer -abc
* Client name -QA acharya
*/
public class Test
- Java Comment is Used to hide the selected code.
- Comments are used to write a detailed description of application logic to understand the logic easily.
- When we write the comments the application maintenance will become easy.
- Comments are non-executable code these are ignored during compilation.
- Java Comment is used to provide the details or explanation of variables,method,class or any other statements
There are 3
types of java comments.
1) Single-line Comments
2) Multi-line Comments
3)Documentation Comments
1) Single-line Comments
Single Line Comment is used to write the description in a single line.
Syntax of Single line Comments
//description
Example of a Single line comment
public class Test
public class Test
{
public static void main(String[] args)
{
int x=40;//Here, xis a variable
System.out.println(x);
}
}
int x=40;//Here, xis a variable
System.out.println(x);
}
}
2) Multi-line Comments
Java Multi-line Comment is used To write the description in more than one line. Starts /* ends
*/
Syntax of Multi line comment
/*
satement-1
Statement-2
;;;;;;;;;;;;;;
Statement-n
*/
Example of multi-line comment
public class Test
public class Test
{
public static void main(String[] args)
{
/*This is an example of
Multi-line comment*/
int x=40;
System.out.println(x);
}
}
int x=40;
System.out.println(x);
}
}
3)Documentation
Comments
In Java ,Documentation Comments Used to prepare API documents.
Syntax of Documentation Comments: -
/*
*statement-1
*statement-2
*/
Example Documentation comment /**
*project Name -Test
* Developer -abc
* Client name -QA acharya
*/
public class Test
{
public static void main(String[] args)
{
int x=40;
System.out.println(x);
}
}
Hope The above Tutorial comment in java helpful for you ....
Team
QA acharya
Tags: Java comment , types of java comment , comment in java , java comment example , comment type in java , Single line comment in java , multiline comment in java
Related post :
System.out.println(x);
}
}
Hope The above Tutorial comment in java helpful for you ....
Team
QA acharya
Tags: Java comment , types of java comment , comment in java , java comment example , comment type in java , Single line comment in java , multiline comment in java
Related post :
![]() |
Comment In Java |
0 Comments