![]() |
VOOZH | about |
The equals() method of Java File Class compares the pathname supplied in the argument to the pathname provided in the argument. If the parameter is not null and points to the same file or directory, this function returns true. The operating system determines if the two abstract pathnames are equivalent or not.
Syntax:
public boolean equals(Object obj)
Parameters:
Return Value: It returns true, if and only if the items are the same; otherwise, false.
Example:
The method compares two File instances to see whether they are the same. This approach does not compare the content of the file or directory; instead, it checks if the pathnames are the same.
Output:
👁 Image