Java FileTime.equals(Object obj)

Syntax

FileTime.equals(Object obj) has the following syntax.

public boolean equals(Object obj)

Example

In the following code shows how to use FileTime.equals(Object obj) method.


//from  ww  w .  j  a  v a2 s  .co  m
import java.nio.file.attribute.FileTime;
import java.util.concurrent.TimeUnit;

public class Main {

  public static void main(String[] args) throws Exception {

    long time = System.currentTimeMillis();
    FileTime fileTime = FileTime.fromMillis(time);
    
    FileTime fileTime1 = FileTime.from(time,TimeUnit.MILLISECONDS);
    
    
    System.out.println(fileTime.equals(fileTime1));

  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.nio.file.attribute »




BasicFileAttributes
BasicFileAttributeView
DosFileAttributes
FileTime
PosixFileAttributes
PosixFilePermissions