Convert String to int - Java Language Basics

Java examples for Language Basics:String

Description

Convert String to int

Demo Code


public class Main {
 
  public static void main(String[] args) {
    String str = new String("10");
    int i = Integer.parseInt(str);
    System.out.println(i);/*from   ww w.  j  av a2s  .c  om*/
  }
}

Result


Related Tutorials