Java Data Type Tutorial - Java System .setSecurityManager ( SecurityManager s)








Syntax

System.setSecurityManager(SecurityManager s) has the following syntax.

public static void setSecurityManager(SecurityManager s)

Example

In the following code shows how to use System.setSecurityManager(SecurityManager s) method.

/*from   ww w . j a v a2s .c o  m*/

public class Main {

  public static void main(String[] args) throws Exception {

    if (System.getSecurityManager() == null) {
      System.setSecurityManager(new SecurityManager());
    }
  }
}