Java Data Type Tutorial - Java Integer.getInteger(String nm, Integer val)








Syntax

Integer.getInteger(String nm, Integer val) has the following syntax.

public static Integer getInteger(String nm, Integer val)

Example

In the following code shows how to use Integer.getInteger(String nm, Integer val) method.

public class Main{
   public static void main(String[] args) {
     String myKey = "MyKey";
     System.setProperty(myKey, "102");
     System.out.println(Integer.getInteger(myKey));
     System.out.println(Integer.getInteger("NoExist",new Integer(999)));
   }
}

The code above generates the following result.