The decode() method of Integer class decodes a String into an Integer. It can accept decimal, hexadecimal and octal numbers.

Syntax

public static Integer decode(String nm) throws NumberFormatException

 Parameters

The parameter ‘nm’ represents the String to decode.

 Throws:

The decode() method throws :

NumberFormatException- if the String does not contains a parsable integer.

 Return Value

This method returns an Integer object holding the int value of string ‘nm’.

 Example 1

Output

Example 2

Output

Example 3

Output

Pin It on Pinterest

Share This