Page 246 - CA_Blue( J )_Class10
P. 246

Let's Revisit


                    ®  A method is a block of statements used to perform a particular operation.
                    ®  The methods that are already defined in the packages of Java and available to use in the form of class library are called
                     predefined methods.
                    ®  A method written by the programmer according to his requirements is known as a "user-defined method."
                    ®  Method signature is a part of method header containing only the name of the method along with parameter list.
                    ®  An access specifier or access modifier specifies the boundary for a method in which it is accessible.
                    ®  The return statement is required if the function is returning some value.
                    ®  The actual values that are passed directly or through variables to the respective method at the time of calling the method
                     are called actual parameters.
                    ®  The parameters that receive the values from the caller program are known as formal parameters.
                    ®  In call by value, a method is called by passing the value of parameters.
                    ®  In pass by reference, the actual parameter and the formal parameter shares the same location in the memory.
                    ®  A static method is common to all the objects of the class.
                    ®  A non-static method is also known as instance method.
                    ®  A pure method does not change the state of an object and also returns a value to the method from where it is called.
                    ®  An impure method changes the state of an object.
                    ®  Method overloading is the process of creating different methods with same name and different number of parameters or
                     different data types of the parameters.




                                                           MIND DRILL






                   Solved Questions



              A.  Tick ( ) the correct answer.
                  1.  The methods that are created by a programmer according to his requirements are called ………………… methods.
                     a.  Built-in                                   b.  User-defined
                     c.  System methods                             d.  Static methods
                  2.  Which of the following is the correct signature of the sum( ) method?
                     a.  int sum(int a, int b)                      b.  public int sum(int a, int b)
                     c.  sum(int a, int b)                          d.  public static int sum(int a, int b)
                  3.  Which of the following is the parameter that receive the values from the caller program?
                     a.  Formal parameters                          b.  Actual parameters
                     c.  Default parameter                          d.  Reference parameter
                  4.  Which of the following access specifiers  allows a method to be accessible anywhere inside the class and also outside the class?
                     a.  public                                     b.  private
                     c.  protected                                  d.  default
                  5.  Which of the following is a block of statements in a program that performs a specific task?
                     a.  Class                                      b.  Object
                     c.  Method                                     d.  Data type
                  6.  Which of the following is not an access specifier?
                     a.  public                                     b.  private
                     c.  protected                                  d.  static

                244244  Touchpad Computer Applications-X
   241   242   243   244   245   246   247   248   249   250   251