Copyright © tutorialspoint.com

Java - parseInt() Method

previous next


Description:

This method is used to get the primitive data type of a certain String. parseXxx() is a static method and can have one argument or two.

Syntax:

All the variant of this method are given below:

static int parseInt(String s)

static int parseInt(String s, int radix)

Parameters:

Here is the detail of parameters:

Return Value :

Example:

public class Test{ 
   public static void main(String args[]){
      int x =Integer.parseInt("9");
      double c = Double.parseDouble("5");
      int b = Integer.parseInt("444",16);

      System.out.println(x);
      System.out.println(c);
      System.out.println(b);
   }
}

This produces following result:

9
5.0
1092

previous next

Copyright © tutorialspoint.com