import java.io.File;
public class ROW {
public static void main(String[] args) {
File filespec = new File("c:\text.txt");
if (filespec.setWritable(false))
System.out.println(filespec + " made read-only");
else
System.out.println("Permission denied");
if (filespec.setWritable(true))
System.out.println(filespec + " made writable");
else
System.out.println("Permission denied");
System.out.println(filespec + " is currently "
+ (filespec.canWrite() ? "writable" : "read-only"));
}
}