본문 바로가기
  • think normal
새로워지기/서른의 생활코딩

ex2) java.io.*

by 청춘만화 2012. 3. 6.

import java.io.*;
 
public class FileTest {
public static void main( String[] args ) {
try {
// File 객체 생성
File temp = new File( "C:/java", "temp" );
File tempFile = new File( "test" );
File fa = new File( "test.txt" );
// 디렉토리 생성
System.out.println( "create directory state : " + temp.mkdirs() );
System.out.println( "create directory state : " + tempFile.mkdir() );
// File에 관련된 메소드
System.out.println( "file canRead : " + fa.canRead() );
System.out.println( "temp canRead : " + temp.canRead() );
System.out.println( "temp canWrite : " + temp.canWrite() );
System.out.println( "temp getAbsoluteFile : " + temp.getAbsoluteFile() );
System.out.println( "temp getName : " + temp.getName() );
System.out.println( "temp getParent : " + temp.getParent() );
System.out.println( "temp getPath : " + temp.getPath() );
System.out.println( "temp isDirectory : " + temp.isDirectory() );
System.out.println( "temp isFile : " + temp.isFile() );
} catch ( Exception e ) {
}
}
}

'새로워지기 > 서른의 생활코딩' 카테고리의 다른 글

ex4) java.io.*  (0) 2012.03.06
ex3) java.io.*  (0) 2012.03.06
ex1) java.io.*  (0) 2012.03.06
java _2012.03.05  (0) 2012.03.06
ex8) java.awt.*  (0) 2012.03.04

댓글