**
重载3个不同版本的max方法和min方法,这些方法均有3个参数,分别用来求3个int、3个long、3个float数的最大值和最小值。编写Java应用程序,使用这些方法。
**
class s
{ public int max(int x, int y, int z) {
int c;
c=Math.max(Math.max(x, y), z);
return c;
}
public int min(int x,int y, int z)
{ int c;
c=Math.min(Math.min(x, y), z);
return c;
}
public long max(long x,long y,long z)
{
long c;
c=Math.max(Math.max(x, y), z);
return c;
}
public long min(long x,long y,long z )
{ long c;
c=Math.min(Math.min(x, y), z);
return c;
}
public float max(float x, float y, float z) {
float c;
c=Math.max(Math.max(x, y), z);
return c;
}
public float min(float x,float y,float z)
{
float c;
c=Math.min(Math.min(x, y), z);
return c;
}
}
public class 比大小 {
public static void main(String[] args) {
s c= new s();
System.out.println(c.max(1,2,3));
System.out.println(c.min(1,2,3));
}
}