Wednesday, 16 April 2014

file.io.File methods usage

public class TestFile
{
 public static void main (String a[])
 {
  java.io.File file = new java.io.File("image/splash_image2.png");
  System.out.println("Existance : "+ file.exists());
  System.out.println("Length of file in bytes: "+ file.length());
  System.out.println("Readable : "+ file.canRead());
  System.out.println("Writeable : "+ file.canWrite());
  System.out.println("Directory : "+ file.isDirectory());
  System.out.println("File ? : "+ file.isFile());
  System.out.println("Absolute : "+ file.isAbsolute());
  System.out.println("Absolute path : "+ file.getAbsolutePath());
  System.out.println("Last Modified : "+ new java.util.Date(file.lastModified()));
 
 }
}

No comments:

Post a Comment