0

how to do it?

import java.util.HashMap; import java.util.Scanner; public class Main { public static void main(String[ ] args) { Scanner scanner = new Scanner(System.in); HashMap<String, Integer> ages = new HashMap<String, Integer>(); ages.put("David", 22); ages.put("Tom", 23); ages.put("Robert", 32); ages.put("Alice", 21); ages.put("Sophie", 19); ages.put("Maria", 24); ages.put("John", 28); String[] nameArr = new String[ages.size()]; nameArr = ages.keySet().toArray(nameArr); int ageLimit = scanner.nextInt(); for (String emp : nameArr){ if(ages.get(emp) < ageLimit); //введите код сюда ages.remove(emp); } System.out.println(ages); } }

3rd Dec 2022, 8:24 PM
Кирило Шмуш
Кирило Шмуш - avatar
2 Réponses
+ 1
Is this a task? Can you include which one and maybe the task description?
3rd Dec 2022, 8:44 PM
Ausgrindtube
Ausgrindtube - avatar
+ 1
Четко добавьте описание задачи и проблему с кодом... https://www.sololearn.com/discuss/333866/?ref=app edit: if(ages.get(emp) < ageLimit); 👈полуколонна после того, как блок заканчивается блоком. так что удали. Кирило Шмуш Add task description and problem with code clearly... if(ages.get(emp) < ageLimit); 👈semi cololn after if block ends block. so remove it.
4th Dec 2022, 11:16 AM
Jayakrishna 🇮🇳