Java - Numbers Class-parseInt() Method - Java


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.


Following are all the variants of this method −


Here is the detail of parameters −

  • s − This is a string representation of decimal.
  • radix − This would be used to convert String s into integer.

Return Value

  • parseInt(String s) − This returns an integer (decimal only).
  • parseInt(int i) − This returns an integer, given a string representation of decimal, binary, octal, or hexadecimal (radix equals 10, 2, 8, or 16 respectively) numbers as input.


This will produce the following result −


All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status

Java Topics