file permission in Java

Java provides a number of method calls to check and change the permission of a file, such as a read-only file can be changed to have permissions to write. File permissions are required to be changed when the user wants to restrict the operations permissible on a file.
<b>Checking the Current File Permissions</b>
Method | Action
--- | --- 
canExecute() | Returns true if and only if the abstract pathname exists and the application is allowed to execute the file
canRead() | Tests whether the application can read the file denoted by this abstract pathname
canWrite() | Returns true if and only if the file system actually contains a file denoted by this abstract pathname and the application is allowed to write to the file; false otherwise

<b>Changing File Permissions</b>
Method | Action
--- | ---
setExecutable() | Set the owner’s execute permission for this abstract pathname
setReadable() | Set the owner’s read permission for this abstract pathname
setWritable() | Set the owner’s write permission for this abstract pathname