When I should go for wrapper class over primitive types? Or On what circumstance I should choose between wrapper / Primitive types?
When I should go for wrapper class over primitive types? Or On what circumstance I should choose between wrapper / Primitive types?
Primitive values in Java are not object. In order to manipulate these values as object the java.lang package provides a wrapper class for each of the primitive data type.
All Wrapper classes are final. The object of all wrapper classes that can be initiated are immutable that means the value in the wrapper object can not be changed.
Although, the void class is considered a wrapper class but it does not wrap any primitive values and is not initiable. It does not have public constructor, it just denotes a class object representing the keyword void.
When to Use Primitive Types
When to Use Wrapper Class
from https://medium.com/@bpnorlander/java-understanding-primitive-types-and-wrapper-objects-a6798fb2afe9