Boolean.getBoolean(String name) has the following syntax.
public static boolean getBoolean(String name)
In the following code shows how to use Boolean.getBoolean(String name) method.
public class Main { /*w w w. jav a2s . c o m*/ public static void main(String[] args) { System.setProperty("demo1","true"); System.setProperty("demo2","abcd"); // assign result of getBoolean on demo1, demo2 to bool1, bool2 boolean bool1 = Boolean.getBoolean("demo1"); boolean bool2 = Boolean.getBoolean("demo2"); System.out.println("boolean value of system property demo1 is " + bool1); System.out.println("boolean value of system property demo2 is " + bool2); } }
The code above generates the following result.
The code above uses System class's setProprty method, set the values of system properties demo1, demo2.