Java Comments

0

/*
Java Comments:
A description about a basic programming element is called comment. Comments are meant for developer to understand the purpose.
Types of comments:
Java supports 3 types of comments
1. Single Line comment (//).
2. Multiline comment (/*    */).
3. Document comment (/**   */).

The statements placed inside these special characters are ignored by compiler while compling the class. It means, compiler will not generate bytecodes for those comments. So comments are not appeared in .class file.
Below program shows usage of all above 3 comments.
*/

//JavaComments.java

/**
* This program shows adding two integer numbers.
* @author: Netlojava
* @company: Netlojava.blogspot.com
* @date: 29-08-2013
* @Version: 1.0
*/

public class JavaComments
{
/*
  This method takes two integer numbers and return their addition result.
*/

           public static void main(String args[])
{
int a,b,c;   // a,b,c are integer varibules
a=5;   //a varibule 
b=6; //b varibule
c=a+b;
//addition of two numbers.
System.out.println(a);
System.out.println(b);
System.out.println(c);
}
}


Compilation:
G:\> javac JavaComments.java

Execution:
G:\> java Java Comments

Out Put:

5
6
11


About the author

Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus. Aenean fermentum, eget tincidunt.

0 comments:

Recent Posts