- Java.util 包类
- Java.util - 首页
- Java.util - ArrayDeque
- Java.util - ArrayList
- Java.util - Arrays
- Java.util - BitSet
- Java.util - Calendar
- Java.util - Collections
- Java.util - Currency
- Java.util - Date
- Java.util - Dictionary
- Java.util - EnumMap
- Java.util - EnumSet
- Java.util - Formatter
- Java.util - GregorianCalendar
- Java.util - HashMap
- Java.util - HashSet
- Java.util - Hashtable
- Java.util - IdentityHashMap
- Java.util - LinkedHashMap
- Java.util - LinkedHashSet
- Java.util - LinkedList
- Java.util - ListResourceBundle
- Java.util - Locale
- Java.util - Observable
- Java.util - PriorityQueue
- Java.util - Properties
- Java.util - PropertyPermission
- Java.util - PropertyResourceBundle
- Java.util - Random
- Java.util - ResourceBundle
- Java.util - ResourceBundle.Control
- Java.util - Scanner
- Java.util - ServiceLoader
- Java.util - SimpleTimeZone
- Java.util - Stack
- Java.util - StringTokenizer
- Java.util - Timer
- Java.util - TimerTask
- Java.util - TimeZone
- Java.util - TreeMap
- Java.util - TreeSet
- Java.util - UUID
- Java.util - Vector
- Java.util - WeakHashMap
- Java.util 包其他内容
- Java.util - 接口
- Java.util - 异常
- Java.util - 枚举
- Java.util 有用资源
- Java.util - 有用资源
- Java.util - 讨论
Java PropertyPermission equals() 方法
描述
java PropertyPermission equals(Object obj) 方法检查此对象是否等于 obj。即它是否与此对象具有相同的名称和操作。
声明
以下是 java PropertyPermission equals() 方法的声明
public boolean equals(Object obj)
参数
obj − 要检查的对象。
返回值
如果给定对象等于此对象(即名称和操作相同),则此方法返回 true。
异常
无
检查两个相同 PropertyPermission 实例是否相等示例
以下示例演示了 Java PropertyPermission equals(Object) 方法的使用,用于检查权限对象。我们构建了一个 PropertyPermission 对象,然后检查该权限是否为读取权限。
package com.tutorialspoint; import java.util.PropertyPermission; public class PropertyPermissionDemo { private static PropertyPermission permission; public static void main(String[] args) { // Build property permissions collection permission = new PropertyPermission("java.home.usr", "read"); // Check file read permissions checkFileReadPermissions("java.home.usr"); } private static void checkFileReadPermissions(String path) { // Check permissions are equal if(permission.equals(new PropertyPermission(path, "read"))) { System.out.println("Has permissions on "+path+" for read"); }else { System.out.println("No permissions on "+path+" for read"); } } }
让我们编译并运行上述程序,这将产生以下结果:
Has permissions on java.home.usr for read
检查两个不同 PropertyPermission 实例是否相等示例
以下示例演示了 Java PropertyPermission equals(Object) 方法的使用,用于检查权限对象。我们构建了一个 PropertyPermission 对象,然后检查该权限是否为写入权限。
package com.tutorialspoint; import java.util.PropertyPermission; public class PropertyPermissionDemo { private static PropertyPermission permission; public static void main(String[] args) { // Build property permissions collection permission = new PropertyPermission("java.home.usr", "read"); // Check file write permissions checkFileWritePermissions("java.home.usr"); } private static void checkFileWritePermissions(String path) { // Check permissions are equal if(permission.equals(new PropertyPermission(path, "write"))) { System.out.println("Has permissions on "+path+" for write"); }else { System.out.println("No permissions on "+path+" for write"); } } }
让我们编译并运行上述程序,这将产生以下结果:
No permissions on java.home.usr for write
java_util_propertypermission.htm
广告