تطبيق على الاوفرلودينج ... ماكس ميثود
Example :
تطبيق على الاوفرلودينج ... ماكس ميثود
______________________________________
Solution :
public static void main (String [] a){
System.out.println(max(1,2));
System.out.println(max(1.2,6.2));
System.out.println(max(9.6,6,8));...
}
public static int max (int a , int b ){
if (a>b)return a;
else if (a<b)return b ;
else return 0;
}
public static double max (double a , double b ){
if (a>b)return a;
else if (a<b)return b ;
else return 0;
}
public static double max (double a , double b , double c){
if (a>b&&a>c)return a ;
else if (b>a&&b>c)return b;
else if (c>b&&c>a)return c ;
else return 0;
}
0 التعليقات: