What is the difference in usage of primitive and wrapper data type and what is the need of wrapper data type?
问题 I searched it all over the web, but all the answers just consisted of the difference. I know the difference, but I don't understand the difference in their applications. For example, suppose we have to take two floating values, if we use double, we can easily compare using a==b , whereas if we use Double, we will have to use a.equals(b) . 回答1: There is more than that behind the scenes. One of the reasons is how the Collections API is developed in Java... Consider that you just can not do