将整数存储到Hashmap中

时间:2019-02-26 21:46:17

标签: java

我需要将0和这样的数字存储在HashMap中:

Map<Integer, String> list = new HashMap<>();

list.put(0742, "Veterinary Services (0742)");
list.put(0743, "Wine producers (0743)");

但是我得到了例外:

The literal 0780 of type int is out of range 

有没有一种方法可以将其更改为String?

0 个答案:

没有答案