Just wondering if this and other related functions like those Integer is one of those things that one should not be bothered with and just go with Long a = 1L; simple and straightforward.
Just wondering if this and other related functions like those Integer is one of
Share
They are essentially the same, the compiler internally creates a call to Long.valueOf() when it has to convert a primitive long to a Long, this is called “boxing”.
In normal code you should use the primitive type long, it is more efficient than Long. You need Long only when you need objects, for example for putting long values into collections.