PropertyPermission implies(Permission) in Java

implies(Permission): This method is available in java.util.PropertyPermission class of Java.

Syntax:

boolean java.util.PropertyPermission.implies(Permission p)

This method takes one argument. This method checks if this PropertyPermission object "implies" the specified permission.

More specifically, this method returns true if:

1. p is an instance of PropertyPermission.

2. p's actions are a subset of this object's actions.

3. p's name is implied by this object name.

For example, "java.*" implies "java.home".

Parameters: One parameter is required for this method.

p: the permission to check against.

Returns: true if the specified permission is implied by this object, false if not.

Exceptions: NA

Approach

Java

import java.util.PropertyPermission;

public class PropertyPermissionimplies {
    public static void main(String[] args) {
        PropertyPermission propertyPermission =
new PropertyPermission("Hello", "read");

        System.out.println(propertyPermission.
implies(propertyPermission));

    }
}

Output:

true


No comments:

Post a Comment