此方法给出两个参数中的最大值。参数可以是int,float,long,double。
此方法具有以下变体-
链接:https://www.learnfk.comhttps://www.learnfk.com/java/number-max.html
来源:LearnFk无涯教程网
double max(double arg1, double arg2) float max(float arg1, float arg2) int max(int arg1, int arg2) long max(long arg1, long arg2)
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
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)
Spring Boot与Kubernetes云原生微服务实践 -〔杨波〕
Tony Bai · Go语言第一课 -〔Tony Bai〕
Python实战 · 从0到1搭建直播视频平台 -〔Barry〕