Java examples for File Path IO:Directory
Mark file or directory Read Only
import java.io.*; public class Main { public static void main(String[] args) { File file = new File("C://Folder//demo.txt"); /*from w w w .j a v a2 s .c o m*/ boolean blnMarked = file.setReadOnly(); System.out.println("Was file marked read only ?: " + blnMarked); System.out.println("Is file writable ?: " + file.canWrite()); } }