Home » Java programming language

Java PropertyPermission equals() Method with Example

PropertyPermission Class equals() method: Here, we are going to learn about the equals() method of PropertyPermission Class with its syntax and example.
Submitted by Preeti Jain, on March 21, 2020

PropertyPermission Class equals() method

  • equals() method is available in java.util package.
  • equals() method is used to check whether this object and the given object (ob) are equal or not.
  • equals() method is a non-static method, it is accessible with the class object only and if we try to access the method with the class name then we will get an error.
  • equals() method does not throw an exception at the time of checking the equality of two objects.


    public boolean equals(Object ob);


  • Object ob – represents the object to be tested with this object in this PropertyPermission.

Return value:

The return type of the method is boolean, it returns true when both the object are same, equals otherwise it returns false.


// Java program to demonstrate the example 
// of boolean equals(Object ob) method of 
// PropertyPermission

import java.util.*;

public class EqualsOfPropertyPermission {
 public static void main(String arg[]) {
  // Instantiates two PropertyPermission object
  PropertyPermission prop_perm1 = new PropertyPermission("os.version", "write");
  PropertyPermission prop_perm2 = new PropertyPermission("", "read");

  // By using equals() method is to
  // whether two PropertyPermission
  // objects are same or not in terms
  // of name and actions
  boolean status = prop_perm1.equals(prop_perm2);

  System.out.print("prop_perm1.equals(prop_perm2): ");


prop_perm1.equals(prop_perm2): false


Comments and Discussions



Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© some rights reserved.