As I pointed out In my previous answer(How can a string be initialized using " "?)
Yes, to retain primitive
types in an OOP, designers made bridge between primitives
and Object's
with Wrappers
and they have a special treatment.
The reason is clearly explained in docs.
There are, however, reasons to use objects in place of primitives, and the Java platform provides wrapper classes for each of the primitive data types. These classes "wrap" the primitive in an object. Often, the wrapping is done by the compiler—if you use a primitive where an object is expected, the compiler boxes the primitive in its wrapper class for you. Similarly, if you use a number object when a primitive is expected, the compiler unboxes the object for you. For more information, see Autoboxing and Unboxing
We use primitives
extensively in our programs, So it might be a design decision to allowing syntax like
Integer i = 10; //primitive style
Then memory
allocates at compile
time itself for i since it is a primitive
type, when they found with Wrapper
type declarations with an Assignment operator
=
Syntax wise ,that is more handy and happy(at least for me :)).
Than writing,
Integer i = new Integer(10); //Object creation style