Try writing
new Integer("100") or
new Integer(100) with Java9+. Both will compile but will throw warning messages. Just because those
constructors have been deprecated doesn't mean they won't compile.
The reason for deprecating them was that nobody used them any more. If you use those constructors you get different objects every time, which is unnecessary for an immutable type. When boxing and unboxing were introduced in 2004, the
Integer#valueOf(int) method was also introduced (it is sometimes used by the boxing mechanism behind the scenes). That method guarantees to return the same object for values with a small magnitude, as required by the
Java® Language Specification (=JLS). If you reuse the same object you are going to save on memory use, and also get faster execution because you are not taking time unnecessarily creating new Integer instances. Once we realised there was that improvement in performance and memory use we stopped using those constructors, even before 2017 when they were deprecated.