The equals() method tests if the given pathname is equal to that provided in the argument. This method returns true if the argument is not null and is pointing to the same file or directory. Equality depends upon the underlying operating system. Note that on UNIX systems, the alphabetic case is significant in comparing pathnames; on Microsoft Windows systems it is not.
2. Method signature
- obj - object that should be compared with given
- true - if the objects are the same
3.1. The program presents several comparisons on
In this article we presented
File.equals() method available in Java IO API. The method checks if two
File instance is equal. Note that this method does not compare the content of the file or directory, it is only checked if pathnames are the same.