File.setWritable(boolean writable, boolean ownerOnly) has the following syntax.
public boolean setWritable(boolean writable, boolean ownerOnly)
In the following code shows how to use File.setWritable(boolean writable, boolean ownerOnly) method.
// w ww . j a v a 2 s .c o m import java.io.File; public class Main { public static void main(String[] args) { File f = new File("C:/test.txt"); boolean bool = f.setWritable(true, false); System.out.println( bool); bool = f.canWrite(); System.out.print(bool); } }
The code above generates the following result.