Beny's Study
file 권한확인 메소드 _ canRead,canWrite,canExecute 본문
권환 물어보는 메소드
package com.kh.ex01.file;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Arrays;
public class FileBasic {
public static void main(String[] args) {
File file1 = new File("./covid.txt"); // 상대경로(현재파일로부터의 경로),file1에 저장
File file2 = new File(file1.getAbsolutePath());
// 권한물어보기
// .canRead() : 읽기
// .canWrite() : 쓰기
// .canExecute() : 실행권한( 리눅스 전용기능)
System.out.println(file1.canRead());// true
System.out.println(file1.canWrite());// true
System.out.println(file1.canExecute());// true
"본 인터넷 사이트 내의 모든 이미지, 문구, 콘텐츠, 내용 등에 대한 저작권은 76beny에게 있습니다.
이를 무단으로 도용, 복사, 전재, 재배포, 2차 변형 등을 할 경우
민, 형사상 법적 조치 등 저작권법에 의거하여 처벌 받을 수 있습니다."
'[JAVA] > 11.예외처리' 카테고리의 다른 글
file 이름바꾸는 메소드 _ .renameTo( ) (0) | 2022.04.20 |
---|---|
file 권한설정메소드 _ .setWritable( ) (0) | 2022.04.20 |
try ~catch 예문 (0) | 2022.04.20 |
throw와 throws의 차이 (0) | 2022.04.20 |
try~catch 문 _ 예외처리 문법 (0) | 2022.04.20 |