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