Displays on the screen correctly.
But does not pass the test
What is the problem?
package com.codegym.task.task08.task0806;
import java.util.HashMap;
import java.util.Map;
/*
HashMap of Objects
*/
public class Solution {
public static void main(String[] args) throws Exception {
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("Sim", 5);
map.put("Tom", 5.5);
map.put("Arbus", false);
map.put("Baby", null);
map.put("Cat", "Cat");
map.put("Eat", new Long(56));
map.put("Food", new Character('3'));
map.put("Gevey", '6');
map.put("Hugs", 111111111111L);
map.put("Comp", (double) 123);
for (HashMap.Entry<String, Object> x: map.entrySet()){
String key = x.getKey();
String val = String.valueOf(x);
System.out.println(key + " - " + val);
}
}
}
package com.codegym.task.task08.task0806;
import java.util.HashMap;
import java.util.Map;
/*
HashMap of Objects
*/
public class Solution {
public static void main(String[] args) throws Exception {
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("Sim", 5);
map.put("Tom", 5.5);
map.put("Arbus", false);
map.put("Baby", null);
map.put("Cat", "Cat");
map.put("Eat", new Long(56));
map.put("Food", new Character('3'));
map.put("Gevey", '6');
map.put("Hugs", 111111111111L);
map.put("Comp", (double) 123);
for (HashMap.Entry<String, Object> x: map.entrySet()){
String key = x.getKey();
String val = String.valueOf(x);
System.out.println(key + " - " + val);
}
}
}