It is extremely poor practice to litter code with vacuous comments like:
/**
* This method compares the equality of the current object with the object of same type...
*/
This says nothing useful. Worse, it is poor in both style and grammar:
Comments should never start with "This method" or "This class" or "This" anything. The comment is associated with a method or class by its location in the source file.
"the object" should read "an object"
"Compares the equality" makes sense only if the one object can have more "equality" than another. This function does not compare "equality"; it compares objects to determine their equality with each other.
Instead, the comment should indicate when the two objects are considered equal. Here, I would omit the method description entirely, and only document the return value, for example:
public class Fraction {
private int numerator, denominator;
/**
* @return true if <i>this</i> is numerically equal to <i>other</i>
*/
public boolean equals(Fraction other) {
return numerator * other.denominator == other.numerator * denominator;
}
...
}
Generated comments for trivial get/set methods are the worst of all.