In the general case, when you are dealing with a universal object, for example ArrayList<T>
, you need to use objects. The difference between char
and Character
is that Character
is an object and is allowed to be used inside a shared object.
For reference, each primitive type has its own wrapper object. You can check it out here .
source share