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> hasmap = new HashMap<>();
hasmap.put("watermelon","melon");
hasmap.put("banana","fruit");
hasmap.put("cherry","fruit");
hasmap.put("pear","fruit");
hasmap.put("cantaloupe","melon");
hasmap.put("blackberry","fruit");
hasmap.put("ginserg","root");
hasmap.put("strawberry","fruit");
hasmap.put("iris","flower");
hasmap.put("potato","tuber");
for (Map.Entry<String, String> dMap : hasmap.entrySet()) {
System.out.println(dMap.getKey() + " - " + dMap.getValue());
}
}
}
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> hasmap = new HashMap<>();
hasmap.put("watermelon","melon");
hasmap.put("banana","fruit");
hasmap.put("cherry","fruit");
hasmap.put("pear","fruit");
hasmap.put("cantaloupe","melon");
hasmap.put("blackberry","fruit");
hasmap.put("ginserg","root");
hasmap.put("strawberry","fruit");
hasmap.put("iris","flower");
hasmap.put("potato","tuber");
for (Map.Entry<String, String> dMap : hasmap.entrySet()) {
System.out.println(dMap.getKey() + " - " + dMap.getValue());
}
}
}