How to convert primitive int to Integer in Java

1 Answer

0 votes
public class MyClass {
    public static void main(String args[]) {
        int n = 847;    
        
        Integer i = new Integer(n);
        System.out.println(i);
    }
}




/*
run:

847

*/

 



answered Mar 17, 2021 by avibootz
...