Page 278 - ComputerScience_Class_11
P. 278

53              else

                54                  System.out.println("Invalid input");
                55              ob.print();
                56          }
                57      }


              The output of the preceding program is as follows:

                     BlueJ: Terminal Window - Java
                 Options

                Enter Name of Customer : Ajay
                Enter account number of Customer : 20102
                Enter type of account of Customer : s
                Enter the balance amount in the account (minimum amount 1000/-) : 3000
                Enter (D)eposit/(W)ithdraw:
                D
                Enter the amount to deposit:
                2000
                Customer Name:Ajay
                Account No.:20102
                Balance:5000
                Type of Account:s




                            Let’s Revisit


                    ♦ Methods contain specific tasks which are invoked only when they are required.
                    ♦ The first line of any method definition is known as the method header or method prototype.
                    ♦ The name of the method along with its parameter list in the method header is called the method signature.
                    ♦ There has to be some restriction on the accessibility of the methods as they can also be accessed by other methods, same or
                   different class.
                    ♦ A function can be used only when it is called from another function.
                    ♦ Return Statement statement is used when the function is returning some value.
                    ♦ Every method should have a name, by which it can be called from the same class or different classes.
                    ♦ Parameter list is a list of the variables which is sent to the method for execution.
                    ♦ The actual values that are passed directly or through the variables to the respective method at the time of calling the method
                   are called the actual parameters.
                    ♦ The values sent by the calling method are received in the parameters described in the method are called formal parameters.
                    ♦ After declaring and defining a method, we must call it or invoke it so that the job assigned to the method (statements provided
                   in the method) can be executed.













                  276  Touchpad Computer Science (Ver. 3.0)-XI
   273   274   275   276   277   278   279   280   281   282   283