我需要北、南、东和西中的最高值,结果,我只需要返回北、南、东或西的名称。必须通过比较北、南、东、西的所有值来获得最大值。
下面是我的代码片段。
public String startpgm(String x){
String result=null;
double priority = 0;
double North = 1;
double South = 3;
double East = 4;
double West = 5;
System.out.println("Priority:"+Math.max(North, South)); //I am getting the max value, what i need is North or South!!
priority= Math.max(North, South);
result = Double.toString(priority);
return result ;
}