|
Java 实例 - 设置文件只读
以下实例演示了使用 File 类的 file.setReadOnly() 和 file.canWrite() 方法来设置文件只读:
Main.java 文件 import java . io . File ;
public class Main {
public static void main ( String [ ] args ) {
File file = new File ( " C:/java.txt " ) ;
System . out . println ( file . setReadOnly ( ) ) ;
System . out . println ( file . canWrite ( ) ) ;
}
} |
以上代码运行输出结果为:
true
false
程序猿的技术大观园:www.javathinker.net
[这个贴子最后由 flybird 在 2020-01-26 16:46:21 重新编辑]
|
网站系统异常
系统异常信息 |
Request URL:
http://www.javathinker.net/WEB-INF/lybbs/jsp/topic.jsp?postID=1505&replyID=0&skin=1&saveSkin=true&pages=1&replyNum=
java.lang.NullPointerException
如果你不知道错误发生的原因,请把上面完整的信息提交给本站管理人员。
|
|