此方法给出两个参数中的最大值。参数可以是int,float,long,double。
max() - 语法
此方法具有以下变体-
double max(double arg1, double arg2) float max(float arg1, float arg2) int max(int arg1, int arg2) long max(long arg1, long arg2)
max() - 返回值
- 此方法返回两个参数中的最大值。
max() - 示例
public class Test { public static void main(String args[]) { System.out.println(Math.max(12.123, 12.456)); System.out.println(Math.max(23.12, 23.0)); } }
这将产生以下输出-
12.456 23.12
参考链接
https://www.learnfk.com/java/number-max.html
标签:Java,int,max,arg2,float,无涯,long,arg1 From: https://blog.51cto.com/u_14033984/8806534