How to set value to Integer object in Java

3 Answers

0 votes
package javaapplication1;

public class JavaApplication1 {

    public static void main(String[] args) {
       
        Integer iObj = 1000;
        System.out.println(iObj);
    }
}
   
/*
      
run:
      
1000
  
*/

 



answered Nov 8, 2016 by avibootz
0 votes
package javaapplication1;

public class JavaApplication1 {

    public static void main(String[] args) {
       
        Integer iObj = new Integer("1000");
        System.out.println(iObj);
    }
}
   
/*
      
run:
      
1000
  
*/

 



answered Nov 8, 2016 by avibootz
0 votes
package javaapplication1;

public class JavaApplication1 {

    public static void main(String[] args) {
       
        int i = 1000;
        
        Integer iObj = i;
        System.out.println(iObj);
    }
}
   
/*
      
run:
      
1000
  
*/

 



answered Nov 8, 2016 by avibootz

Related questions

3 answers 273 views
4 answers 333 views
333 views asked Nov 8, 2016 by avibootz
4 answers 339 views
339 views asked Nov 8, 2016 by avibootz
3 answers 258 views
3 answers 430 views
430 views asked Nov 8, 2016 by avibootz
3 answers 299 views
299 views asked Nov 8, 2016 by avibootz
...