更新时间:2023-11-15 16:57:28
You could try this to populate the maps:
while(scan.hasNextLine())
{
String key = (String) scan.next();
Map1.put(key, scan.nextInt());
Map2.put(key, scan.nextInt());
}
To access a single key, use hashmap.get(key).
To access the key or entry set as a whole, check out hashmap.entrySet() and keySet() methods