/**
* 文件属性的设置
* @author lyl
*
*/
public class SetFileProperty {
public static void main(String[] args) {
File file=new File("text.file");
//在设置这些属性之情,我们先去设定这个文件为不可读,不可写,右键该文件,属性,安全,编辑
if (file.exists()) {
//将文件设定为可写
file.setWritable(false);
//将文件设定为可读
file.setReadable(false);
//将文件设定为只读
file.setReadOnly();
}
}
}