Comparing Integer objects vs int

前端 未结 5 1622
余生分开走
余生分开走 2020-12-10 17:14

I fixed an endless loop by changing Integer to int in the following:

public class IntTest {
    public static void main(String[] args) {
        Integer x=-1         


        
5条回答
  •  时光说笑
    2020-12-10 17:39

    You can use Integer.intValue() to get the int value for comparison, if you truly need to use Integer at all.

提交回复
热议问题