Java Comments
The java remarks are articulations that are not executed by the compiler and mediator. The remarks can be utilized to give data or clarification about the variable, strategy, class or any announcement. It can likewise be utilized to shroud program code for the particular time.
Types Of Comments In Java
- Single Line Comment
- Multi-Line Comment
- Documentation Comment
1. Java Single Line Comment with Example
The single line comment is most widely used to only one line.
Syntax:
//This is single line comments
Example:
public class my
{
public static void main(String[] args)
{
int d=5;
// int a=55 single line commnets
System.out.println(d);
}
}
Output:
10
2. Java MultiLine Comment with Example
The multi-line remark is utilized to remark numerous lines of code.
Syntax:
/*
Multiline Comment
*/
Example:
public class my
{
public static void main(String[] args)
{
/*
int a=10;
int b=10; // Multi Line Comments
int c=10;
*/
int i=10;
System.out.println(i);
}
}
3. Java Documentation Comment with Example
The documentation remark is utilized to make documentation API. To make documentation API, you have to utilize Javadoc instrument
Syntax
/**
documentation
comment
*/
Example:
public class my
{
/** The add() method returns addition of given numbers.*/
public static int add(int x, int y)
{
return x+y;
}
/** The sub() method returns subtraction of given numbers.*/
public static int sub(int x, int y)
{
return x-y;
}
}
Thanks for Sharing an Information to us . If Someone wants to know about Digital Marketing Course and Web Development Courses. I think this is the right place for you.
ReplyDeleteSEO Courses in coimbatore and Digital Marketing Courses in Coimbatore
Only aspire to mention ones content can be as incredible. This clarity with your post is superb and that i may think you’re a guru for this issue. High-quality along with your concur permit me to to seize your current give to keep modified by using approaching blog post. Thanks a lot hundreds of along with you should go on the pleasurable get the job done.
ReplyDeleteJava代写