checkGuard(Object): This method is available in java.util.PropertyPermission class of Java.
Syntax:
void java.security.Permission.checkGuard(Object object) throws SecurityException
This method takes one argument. This method implements the guard interface for permission.
Note Returns silently if access is granted. Otherwise, throws a SecurityException.
Parameters: One parameter is required for this method.
object: the object being guarded.
Throws:
SecurityException - if a security manager exists and its checkPermission method doesn't allow access.
Approach
Java
import java.util.PropertyPermission;public class PropertyPermissioncheckGuard {public static void main(String[] args) {PropertyPermission propertyPermission =new PropertyPermission("Hello", "read");Object object = "Hello";propertyPermission.checkGuard(object);System.out.println(propertyPermission);}}
Output:
("java.util.PropertyPermission" "Hello" "read")
No comments:
Post a Comment