Convert String to Integer object - Java Language Basics

Java examples for Language Basics:int

Description

Convert String to Integer object

Demo Code

 
public class Main {
 
  public static void main(String[] args) {
    Integer intObj1 = new Integer("100");
    System.out.println(intObj1);/*w w w. jav  a2 s. c  om*/
   
    String str = "100";
    Integer intObj2 = Integer.valueOf(str);
    System.out.println(intObj2);
   
  }
}

Result


Related Tutorials