Object or primitive type
问题 Can someone explain to me the usage of Integer, Boolean etc in place of their primitive types in JAVA? I can't seem to grasp the advantages their are providing. They seem to create unnecessary problems of handling null values. Thanks! 回答1: Boolean , Integer , Long , ... are Objects. You can use them in places where you can't use primitive types, e.g. storing them in a Collection like a Map using them as template parameter assigning them a null value using them in a more general way (e.g. Long