Page 26 - PowerPoint Presentation
P. 26

Method Overloading










                                         public static int max(int num1, int num2){

                                            if (num1 > num2)

                                               return num1;
                                            else

                                               return num2;

                                          }



                                          public static double max(double num1, double num2){

                                            if (num1 > num2)

                                               return num1;
                                            else

                                               return num2;

                                          }
   21   22   23   24   25   26   27   28   29   30   31