Page 122 - CA_Blue( J )_Class9
P. 122

int a,b;
                             a=5;
                             b=2;
                             if(a==b)
                                   System.out.println(“Equal”);
                             else
                                   System.out.println(“Not Equal”);

                  6.1.3 Documentation Comments
                  These comments are used to write the documentation part of the program such as question of the program, name
                  of the programmer, etc. We do not write the program logic here. After “/**” we start writing the comment and
                  end with “*/”.
                  For example:

                  /** This is a comment. */

                   Program 1      Write a program to print the area and perimeter of a square.

                     1     /** This program calculates the area and perimeter of a square*/

                     2     class area_perimeter
                     3         {

                     4         public static void main ()
                     5         {

                     6             int s=25, a,p;
                     7             a=s*s;
                     8             p=4*s;

                     9             System.out.println("Area of the square:" +a);

                    10             System.out.println("Perimeter of the square:" +p);
                    11         }
                    12     }

                  You will get the following output:
























                   120    Touchpad Computer Applications-IX
   117   118   119   120   121   122   123   124   125   126   127