Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
Tags
- 타카마루
- 코로나백신이상증상
- 핸드폰 찾기
- 노리로또
- cisco vpn
- 화이자백신
- 10원단위 올림
- 코로나백신 부작용
- 코로나백신 갈증
- takanaru
- 성수족발
- Windows10
- 랍스터 찜
- 크롬 인너넷연결 안됨
- 크롬 인터넷연결
- 응용 프로그램 내 구입
- 안드로이드폰 위치
- 크롬 타임아웃
- 분기날짜
- 오라클
- windows10 cisco vpn
- windows10 크롬
- 로니세라
- 신주쿠맛집
- 윈도우10 vpn
- 코로나백신 어지러움
- 강화 프로방스
- 코로나백신
- 10 올림
- 신주쿠 로컬식당
Archives
- Today
- Total
이거 맘대로 되는 세상이 아니구만...
Stream 5.1(파일목록출력하기) 본문
반응형
▶파일 목록 출력하기
☆작업 디렉토리에 대한 정보를 알고자 한다면 파일객체를 생성하면 된다
☆현재디렉토리의 파일객체생성
ex)File f=new File(".");
☆상위 디렉토리의 파일객체생성
ex)File f=new File("..")
import java.io.*;
public class SystemInMain {
public static void main(String args[]) throws IOException{
File f=new File("."); //현재 디렉토리의 파일 객체 생성
File f1=new File(".."); //상위 디렉토리의 파일 객체 생성
System.out.println("AbsolutePath"); //절대경로
System.out.println("Current f : "+f.getAbsolutePath());
System.out.println("Current f1 : "+f1.getAbsolutePath());
System.out.println("CanonicalPath"); //일반경로
System.out.println("Current f : "+f.getCanonicalPath());
System.out.println("Current f1 : "+f1.getCanonicalPath());
//절대경로를 이요한 파일 객체 생
File f3=new File("c:\");
System.out.println("c:\ : "+f3.getAbsolutePath());
}
}
☆작업 디렉토리에 대한 정보를 알고자 한다면 파일객체를 생성하면 된다
☆현재디렉토리의 파일객체생성
ex)File f=new File(".");
☆상위 디렉토리의 파일객체생성
ex)File f=new File("..")
import java.io.*;
public class SystemInMain {
public static void main(String args[]) throws IOException{
File f=new File("."); //현재 디렉토리의 파일 객체 생성
File f1=new File(".."); //상위 디렉토리의 파일 객체 생성
System.out.println("AbsolutePath"); //절대경로
System.out.println("Current f : "+f.getAbsolutePath());
System.out.println("Current f1 : "+f1.getAbsolutePath());
System.out.println("CanonicalPath"); //일반경로
System.out.println("Current f : "+f.getCanonicalPath());
System.out.println("Current f1 : "+f1.getCanonicalPath());
//절대경로를 이요한 파일 객체 생
File f3=new File("c:\");
System.out.println("c:\ : "+f3.getAbsolutePath());
}
}

Comments