Home »
Java programming language
Java PropertyPermission getActions() Method with Example
PropertyPermission Class getActions() method: Here, we are going to learn about the getActions() method of PropertyPermission Class with its syntax and example.
Submitted by Preeti Jain, on March 21, 2020
PropertyPermission Class getActions() method
- getActions() method is available in java.util package.
- getActions() method is used to get the list of current actions in the form of string denotation.
- getActions() 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.
- getActions() method does not throw an exception at the time of getting a set of actions.
Syntax:
public String getActions();
Parameter(s):
- It does not accept any parameter.
Return value:
The return type of the method is String, it retrieves the string denotations of the actions.
Example:
// Java program to demonstrate the example
// of String getActions() method of
// PropertyPermission
import java.util.*;
public class GetActionsOfPropertyPermission {
public static void main(String arg[]) {
// Instantiates two PropertyPermission object
PropertyPermission prop_perm1 = new PropertyPermission("os.version", "write");
PropertyPermission prop_perm2 = new PropertyPermission("os.name", "read");
// By using getActions() method is to
// returns the action on at the property
// on the objects prop_perm1, prop_perm2
String action1 = prop_perm1.getActions();
String action2 = prop_perm2.getActions();
// Display action on prop_perm1
System.out.print("prop_perm1.getActions(): ");
System.out.println(action1);
// Display action on prop_perm2
System.out.print("prop_perm2.getActions(): ");
System.out.println(action2);
}
}
Output
prop_perm1.getActions(): write
prop_perm2.getActions(): read