Java.io.FilePermission.hashCode() Method

Advertisements


Description

The java.io.FileOutputStream.hashCode() method returns the hash code value of this object.

Declaration

Following is the declaration for java.io.FilePermission.hashCode() method:

public int hashCode()

Parameters

  • NA

Return Value

This method returns the hash code value of this object.

Exception

  • NA

Example

The following example shows the usage of java.io.FilePermission.hashCode() method.

package com.tutorialspoint;

import java.io.FilePermission;
import java.io.IOException;

public class FilePermissionDemo {
   public static void main(String[] args) throws IOException {
      
      FilePermission fp = null;
      
      try{
         // create new file permissions
         fp=new FilePermission("C://test.txt", "read");
         
         // the hash code value
         int hash = fp.hashCode();
         
         // prints
         System.out.print("Hash Code: "+hash);
         
      }catch(Exception ex){
         // if an error occurs
         ex.printStackTrace();
      }
   }
}

Let us compile and run the above program, this will produce the following result:

Hash Code: 1420469497



Advertisements
Advertisements