第1个回答 2010-06-04
public class Test {
public static void main(String[] args) {
System.out.println(Math.max(3, 4));
}
}
因为不知道你比的是double型还int型,或者其他类型,所以把相关方法全贴这了。
static double max(double a, double b)
返回两个 double 值中较大的一个。
static float max(float a, float b)
返回两个 float 值中较大的一个。
static int max(int a, int b)
返回两个 int 值中较大的一个。
static long max(long a, long b)
返回两个 long 值中较大的一个。