在工作时,我收到了警告。
The constructor Integer(int) is deprecated
我在网上找不到可替代的构造函数/解决方案。我该如何解决这个问题?
更新
对于其他基本包装类型的构造函数,例如,我会得到类似的警告。
The constructor Boolean(boolean) is deprecated
The constructor Byte(byte) is deprecated
The constructor Short(short) is deprecated
The constructor Character(char) is deprecated
The constructor Long(long) is deprecated
The constructor Float(float) is deprecated
The constructor Double(double) is deprecated
这些类是否适用于与Integer
相同的解决方案?
valueOf
将返回这些实例而不是反复创建新实例。 - AxelH