DecimalFormat equals() method in Java
The equals() method is a built-in method of the java.text.DecimalFormat class accepts an argument which is an object and returns true if this argument object is same as the object, else it returns false.
public boolean equals(Object arg)
Parameters: The function accepts a single mandatory parameter arg which specifies the object which is to be compared with.
Return Value: The function returns a boolean value. It returns true if both the objects are same else it returns false.
Below is the implementation of the above function:
Yes both are equal
Yes both are not equal
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.