What is the rationale of not providing no-arg constructors in Wrapper Classes? I know that they were inherently built for Wrapping primitive types, so the right way is to provide a primitive type for constructors.
However, considering primitive types have no-arg constructor, why don’t they have one?
Besides, if they had no-arg constructors, they could be instantiated as T.class.newInstance(). However, since newInstance() requires no-arg constructor, this won’t work with Wrapper Classes.
Wrapper objects are immutable. This means that once a wrapper object has a value assigned to it, that value cannot be changed. It doesn’t make much sense to have a default value for an object whose value can’t be changed. You wouldn’t want to get a
newInstance()of a wrapper class, because then you’d be stuck with the default value.