PropertyPermission equals(Object) in Java

equals(Object): This method is available in java.util.PropertyPermission class of Java.

Syntax:

boolean java.util.PropertyPermission.equals(Object obj)

This method takes one argument. This method checks two PropertyPermission objects for equality. Checks that obj is a  PropertyPermission, and has the same name and actions as this object.

Parameters: One parameter is required for this method.

obj: the object we are testing for equality with this object.

Returns: true if obj is a PropertyPermission, and has the same name and actions as this PropertyPermission object.

Exceptions: NA

Approach

Java

import java.util.PropertyPermission;

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

        PropertyPermission object =
new PropertyPermission("Hello", "read");

        System.out.println(propertyPermission.equals(object));

    }
}

Output:

true


No comments:

Post a Comment