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 408 views
4 answers 485 views
485 views asked Nov 8, 2016 by avibootz
4 answers 504 views
504 views asked Nov 8, 2016 by avibootz
3 answers 417 views
3 answers 576 views
576 views asked Nov 8, 2016 by avibootz
3 answers 427 views
427 views asked Nov 8, 2016 by avibootz
...