Using int as a type parameter for java.util.Dictionary

后端 未结 6 2134
孤独总比滥情好
孤独总比滥情好 2021-02-06 22:51

When I try to declare a Dictionary as such:

private Dictionary map;

The compiler gives me the following error:

6条回答
  •  情歌与酒
    2021-02-06 23:13

    To expand on TofuBeer's answer.

    int is a primitive

    Integer is an Object.

    Generics does not support primitives.

提交回复
热议问题