Home » Java programming language

Java FilePermission implies() Method with Example

FilePermission Class implies() method: Here, we are going to learn about the implies() method of FilePermission Class with its syntax and example.
Submitted by Preeti Jain, on April 02, 2020

FilePermission Class implies() method

  • implies() method is available in package.
  • implies() method is used to check whether this FilePermission implies the given permission (perm) or not.
  • implies() 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.
  • implies() method does not throw an exception at the time of implies the given permission.


    public boolean implies(Permission perm);


  • Permission perm – represents the permission object to be checked.

Return value:

The return type of the method is boolean, it returns true based on some statements:

  • When the given permission object is an instance of FilePermission.
  • When the given permission actions are a proper subset of this FilePermission object actions.
  • When the pathname of the given permission object is implied by this FilePermission object pathname.
  • Otherwise, it returns false.


// Java program to demonstrate the example 
// of boolean implies(Permission perm) method 
// of FilePermission


public class ImpliesOfFP {
 public static void main(String[] args) throws Exception {
  FilePermission fp1 = null;
  FilePermission fp2 = null;

  try {
   // Instantiates FilePermission fp1 , fp2 
   fp1 = new FilePermission("D:\\includehelp.txt", "read");
   fp2 = new FilePermission("D:\\includehelp.txt", "write");

   // By using implies() method is to check
   // whether this FilePermission implies the
   // given permission or not
   boolean status = fp1.implies(fp1);
   System.out.println("fp1.implies(fp1): " + status);

   status = fp2.implies(fp1);
   System.out.println("fp2.implies(fp1): " + status);
  } catch (Exception ex) {


fp1.implies(fp1): true
fp2.implies(fp1): 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.