File SetReadable1() Example
Sets the owner's or everybody's read permission for this abstract pathname.
File class SetReadable1() method example. This example shows you how to use SetReadable1 method.This method Sets the owner's or everybody's read permission for this abstract pathname.
Here is the code:-
/**
* @Program that describes a convenience method to set the owner's read permission for
* this abstract pathname.
* SetReadable.java
* Author:-RoseIndia Team
* Date:-31-May-2008
*/
import java.io.*;
public class SetReadable {
public static void main(String[] args) {
File f = new File("/home/girish/Desktop/girish.txt");
if (f.exists()) {
boolean b = f.setReadable(true);
System.out.println("owner's read permission : "+b);
} else {
System.out.println("File cannot exists: ");
}
}
} |
Output of the Program
| owner's read permission : true |
|