Return system property as integer

ReturnMethodSummary
static IntegergetInteger(String nm)Get the system property.
static IntegergetInteger(String nm, int val)Get the integer value of the system property with a default value.
static IntegergetInteger(String nm, Integer val)Returns the integer value of the system property with a default value.

public class Main {
  public static void main(String[] args) {
    System.setProperty("myKey","10");
    System.out.println(Integer.getInteger("myKey"));
  }
}

The output:


10
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.