I tried with ouputs it's fine, displays the largerst value(person) but donno what actually i'm missing little hint. :)
package com.codegym.task.task19.task1920;
/*
The richest
*/
import java.io.BufferedReader;
import java.io.FileReader;
import java.util.Map;
import java.util.TreeMap;
public class Solution {
public static void main(String[] args)throws Exception {
String s = args[0];
BufferedReader br = new BufferedReader(new FileReader(s));
String s1;
Map<String,Double> map = new TreeMap<>();
while (br.ready()){
s1= br.readLine();
String[] str = s1.split(" ");
double value;
//double high=map.get(map.lastKey());
if(map.containsKey(str[0])){
String name = str[0];
value=Double.parseDouble(str[1]);
map.put(name,map.get(name)+value);
}else {
map.put(str[0],Double.valueOf(str[1]));
}
}
String max= null;
double high = Integer.MIN_VALUE;
for (Map.Entry<String,Double> entry : map.entrySet()) {
if (entry.getValue() > high) {
high= entry.getValue();
max= entry.getKey();
}
}
System.out.println(max);
br.close();
}
}