About 4,910,000 results
Open links in new tab
  1. What is the difference between Integer and int in Java?

    Integer refers to wrapper type in Java whereas int is a primitive type. Everything except primitive data types in Java is implemented just as objects that implies Java is a highly qualified pure object …

  2. Java: Integer equals vs. == - Stack Overflow

    As of Java 1.5, you can pretty much interchange Integer with int in many situations. However, I found a potential defect in my code that surprised me a bit. The following code: Integer cdiCt = ....

  3. How can I properly compare two Integers in Java?

    As you can easily see, method 1 calls Integer.equals() (obviously), methods 2-4 result in exactly the same code, unwrapping the values by means of .intValue() and then comparing them directly, and …

  4. java - Using int vs Integer - Stack Overflow

    I came across a class using Integer variables to capture size to be used in a for loop. Is this good practice or should we use the int primitive data type? Integer size = something.getFields().siz...

  5. java - max value of integer - Stack Overflow

    Feb 21, 2013 · 346 In C, the integer (for 32 bit machine) is 32 bits, and it ranges from -32,768 to +32,767. In Java, the integer (long) is also 32 bits, but ranges from -2,147,483,648 to …

  6. java - Long vs Integer, long vs int, what to use and when ... - Stack ...

    Java.util.collections methods usually use the boxed (Object -wrapped) versions, because they need to work for any Object, and a primitive type, like int or long, is not an Object. Another difference is that …

  7. java - Which one to use, int or Integer - Stack Overflow

    May 11, 2017 · Integer is a better option, as it can handle null; for int, null would become 0, silently, if resultSet.getInt(..) is used. Otherwise, it might throw some exception, something like, "Unable to set …

  8. How to convert int[] into List<Integer> in Java? - Stack Overflow

    Jul 2, 2009 · How do I convert int[] into List<Integer> in Java? Of course, I'm interested in any other answer than doing it in a loop, item by item. But if there's no other answer, I'll pick that one as the …

  9. Integer division: How do you produce a double? - Stack Overflow

    In this case, the resulting floating-point value will be a correctly rounded version of the integer value, using IEEE 754 round-to-nearest mode (§4.2.4). 5 can be expressed exactly as a double.

  10. How do I convert a String to an int in Java? - Stack Overflow

    Integer x = Integer.valueOf(str); // or int y = Integer.parseInt(str); There is a slight difference between these methods: valueOf returns a new or cached instance of java.lang.Integer parseInt returns …