How to sum values in java map | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

How to sum values in java map

29th Apr 2017, 12:24 PM
Ken Ben
Ken Ben - avatar
2 Antworten
+ 4
int sum = 0; for (int a : map.values()) { sum=sum+a; } System.out.println(sum);
29th Apr 2017, 12:37 PM
Manideep
Manideep - avatar
0
map.put("A",3); map.put("B",3); map.put("C",3); if i input A input B total : 6 pls how
29th Apr 2017, 12:26 PM
Ken Ben
Ken Ben - avatar