Java – what is the appropriate way to handle warnings: “the expression of X is loaded into X”

I'm not going to close or ignore the expression of type X is boxed into x? Warnings in

I wonder if the correct way to deal with / avoid this warning is if someone is so inclined

Solution

Boxing and unpacking are operations you can do by hand, but they are built in language to avoid repetition you will no doubt encounter

Integer obj = Integer.valueOf(5); // instead of Integer obj = 5;
int i = obj.intValue(); // instead of int i = obj;

In my opinion, the appropriate way to handle this warning is to turn it off But if this is not an option, you can do it

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>