'wrapper classes do not need constructor call?
Wrapper classes are like any other class right? And to create an object we need to use the new keyword followed by the constructor call in Java. So why don't we need the new keyword and constructor call in case of wrapper class objects?
Integer j=50; // an object of Integer is created with value 50 but there is no need of new keyword!
Solution 1:[1]
In the given case, autoboxing will be done by the compiler and that's why we don't need to use 'new' keyword.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
