Java System.getSecurityManager()

Syntax

System.getSecurityManager() has the following syntax.

public static SecurityManager getSecurityManager()

Example

In the following code shows how to use System.getSecurityManager() method.


//from ww w.j a v  a 2s .com
public class Main {

   public static void main(String[] args) {

      SecurityManager s = System.getSecurityManager();
      if(s == null) {
         System.out.println("SecurityManager not established!");
      }   
   }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.lang »




Boolean
Byte
Character
Class
Double
Enum
Float
Integer
Long
Math
Number
Object
Package
Process
ProcessBuilder
Runnable
Runtime
SecurityManager
Short
StackTraceElement
StrictMath
String
StringBuffer
StringBuilder
System
Thread
ThreadGroup
ThreadLocal
Throwable