File: lastModified() : File « « Java by API

File: lastModified()

 * Output:

Abs Path:C:\Java_Dev\workspace\cal\
does not exist
is not writeable
is not readable
is a directoryfalse
might be a named pipe
is not absolute
File last modified:0
File size:0 Bytes



public class MainClass {
    public static void main(String args[]) {
  File f1 = new File("");
  System.out.println("File Name:" + f1.getName());
  System.out.println("Path:" + f1.getPath());
  System.out.println("Abs Path:" + f1.getAbsolutePath());
  System.out.println("Parent:" + f1.getParent());
  System.out.println(f1.exists() ? "exists" : "does not exist");
  System.out.println(f1.canWrite() ? "is writeable" : "is not writeable");
  System.out.println(f1.canRead() ? "is readable" : "is not readable");
  System.out.println("is a directory" + f1.isDirectory() );
  System.out.println(f1.isFile() ? "is normal file" : "might be a named pipe");
  System.out.println(f1.isAbsolute() ? "is absolute" : "is not absolute");
  System.out.println("File last modified:" + f1.lastModified());
  System.out.println("File size:" + f1.length() + " Bytes");


Related examples in the same category

3.File: separatorChar File(String name) File(URI uri) File(String parent, String child)
7.File: canRead()
8.File: canWrite()
9.File: createNewFile()
10.File: createTempFile(String prefix, String suffix)
11.File: delete()
12.File: deleteOnExit()
13.File: exists()
14.File: getAbsoluteFile()
15.File: getAbsolutePath()
16.File: getCanonicalPath()
17.File: getFreeSpace()
18.File: getName()
19.File: getParent()
20.File: getParentFile()
21.File: getPath()
22.File: getTotalSpace()
23.File: getUsableSpace()
24.File: isAbsolute()
25.File: isDirectory()
26.File: isFile()
27.File: listFiles()
28.File: isHidden()
29.File: length()
30.File: list()
31.File: listFiles(FilenameFilter filter)
32.File: listRoots()
33.File: mkdir()
34.File: mkdirs() (Creates a directory including any parent directories)
35.File: renameTo(File newFile)
36.File: setLastModified(long time)
37.File: setReadOnly()
38.File: setWritable(boolean writable)
39.File: toURI()
40.File: toURL()