Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 127 - 2617_JSSPS_C-7
P. 127

    2.   What is the for loop in Java? Write its syntax.

                           3.  Define operators.

                           4.  List the different types of constructors.

                            Scratch Your Brain.                                                         21 st  Century   #Critical Thinking
                                                                                                            Skills
                                                                                                                #Collaboration
                           1.  What will be the output of the following Java codes?
                               a.  public static void main(String args[])                       Write output here:

                                  {
                                      int num=1, square = 0;
                                      while(num <= 10)
                                      {
                                          square = num * num;
                                          System.out.println("Square of "+num+" is: "+square);
                                          num++;
                                      }

                                  }
                               b.  public static void main(String args[])                       Write output here:

                                  {
                                      int i=5;
                                      do
                                      {
                                          System.out.println(i);
                                          i--;

                                      }while(i >= 1);
                                  }

                                                                                                   Java Programming    125

| 122 123 124 125 126 127 128 129 130 131 132 |