天天看点

Java 设置文件只读

import java.io.File;

public class FileReadOnly {
    public static void main(String[] args) {
        File file = new File("cpyFile2");
        file.setReadOnly();
        System.out.println(file.canWrite());
    }
}