Page 228 - ComputerScience_Class_11
P. 228

The output of the preceding program is as follows:

                     BlueJ: Terminal Window - Java

                 Options

                1. Pattern 1
                2. Pattern 2
                Enter your choice
                1
                1
                1 2
                1 2 3
                1 2 3 4



                            Let’s Revisit

                    ♦  Expression statements consist of an expression that calculates certain equations and produces a result.
                    ♦  Declaration statements are used to declare what type of data the variables or constants will contain.
                    ♦  Control statements are used to decide in which direction the program will execute.
                    ♦  The scope of a variable is the part of a program in which the variable is accessible.
                    ♦  When a group of statements is written within a curly bracket, then it is known as a compound statement.
                    ♦  The statements that are  executed  sequentially and represent  the default  flow of the program  are  known  as sequential
                    statements.
                    ♦  Conditional statements follow the conditional flow of control.
                    ♦  Switch case is a multiple-branch selection statement in which multiple conditions can be checked at once.
                    ♦  The situation of moving of control from one case to another case in the absence of a “break” statement is known as Fall
                    Through.
                    ♦  Repetitive flow of control in a program is called a Loop and the repetitive statements are called iterative statements.
                    ♦  The Java for loop executes a set of statements repeatedly for a fixed number of times.
                    ♦  The Java while loop is used to execute a set of statements repeatedly based on a given condition.
                    ♦  The Java do-while loop executes a set of statements repeatedly until the specified condition is true.
                    ♦  When a loop is present inside the body of another loop, it is called a Nested loop.
                    ♦  The break statement is used to exit from the loop or switch statement.
                    ♦  The continue statement works the same as the break statement, but instead of sending the statement outside the loop or
                    switch, it is used to direct the control by sending it to the next iteration in the loop or switch.
                    ♦  In Java, when a method is called, the control is transferred to the method and it must return back to the caller module after the
                    execution of the method.
                    ♦  The built-in methods are also called library or system methods.





















                  226  Touchpad Computer Science (Ver. 3.0)-XI
   223   224   225   226   227   228   229   230   231   232   233