package com.homework.zw; public class Chongzai { public int max(int a, int b) { return a >= b ? a : b; } public double max(double a, double b) { return a >= b ? a : b; } public double max(double a, double b, double c) { return max(max(a, b), c); } }
package com.homework.zw; public class Textmax { public static void main(String[] args) { Chongzai cz = new Chongzai(); System.out.println("25和68中较大的一个是:"+cz.max(25,68)); System.out.println("85.56和36.78中较大的一个是:"+cz.max(85.56,36.78)); System.out.println("289.6、6.8和56.23中最大的为:"+cz.max(289.6,6.8,56.23)); } }