comparing object values The equals method compares two Object values to determine if they are identical. The equals method is…