The equals() method is a built-in method of the java.text.NumberFormat 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
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.