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 {
//write your code here
HashMap<String, String> h = new HashMap<String, String>();
h.put("watermelon" , "melon");
h.put("banana" , "fruit");
h.put("cherry" , "fruit");
h.put("pear" , "fruit");
h.put("cantaloupe" , "melon");
h.put("blackberry" , "fruit");
h.put("ginseng" , "root");
h.put("strawberry" , "fruit");
h.put("iris" , "flower");
h.put("potato" , "tuber");
for(HashMap.Entry<String, String> p : h.entrySet())
{
String key = p.getKey(); // Key
String value = p.getValue(); // Value
System.out.println(key + "-" + value);
}
}}
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 {
//write your code here
HashMap<String, String> h = new HashMap<String, String>();
h.put("watermelon" , "melon");
h.put("banana" , "fruit");
h.put("cherry" , "fruit");
h.put("pear" , "fruit");
h.put("cantaloupe" , "melon");
h.put("blackberry" , "fruit");
h.put("ginseng" , "root");
h.put("strawberry" , "fruit");
h.put("iris" , "flower");
h.put("potato" , "tuber");
for(HashMap.Entry<String, String> p : h.entrySet())
{
String key = p.getKey(); // Key
String value = p.getValue(); // Value
System.out.println(key + "-" + value);
}
}}