everything is fine but the order in the o/p is not as per the requirements :(
package com.codegym.task.task08.task0802;
/*
HashMap of 10 pairs
*/
import java.util.HashMap;
import java.util.Map;
public class Solution {
public static void main(String[] args) throws Exception {
HashMap<String, String> list = new HashMap<String, String>();
list.put("watermelon "," melon");
list.put("banana "," fruit");
list.put("cherry "," fruit");
list.put("pear "," fruit");
list.put("cantaloupe "," melon");
list.put("blackberry "," fruit");
list.put("ginseng "," root");
list.put("strawberry "," fruit");
list.put("iris "," flower");
list.put("potato "," tuber");
for(Map.Entry<String,String> name : list.entrySet()){
String Key = name.getKey();
String Value = name.getValue();
System.out.println(Key+ " - " + Value);
}//write your code here
}
}