package javaapplication1;
import java.io.File;
import java.io.IOException;
public class JavaApplication1 {
public static void main(String[] args) throws IOException {
try {
File file = new File("d://data.txt");
boolean b = file.setWritable(true);
System.out.println(b);
if (file.canWrite() == true)
System.out.println("not read only");
else
System.out.println("read only");
} catch (Exception e) {
System.out.print(e.toString());
}
}
}
/*
run:
true
not read only
*/