NumberFormat Equals() Example
Returns true if this object is the same as the obj argument
NumberFormatclass Equals() method example. This example shows you how to use Equals() method.This method Returns true if this object is the same as the obj argument
Here is the code:-
/**
* @Program that Returns true if this object is the same as the obj argument
* Equals.java
* Author:-RoseIndia Team
* Date:-17-Jun-2008
*/
import java.text.*;
public class Equals {
public static void main(String[] args) {
//Creating Numberformat instance
NumberFormat nf = NumberFormat.getInstance();
NumberFormat nf1 = NumberFormat.getCurrencyInstance();
//Returns true if this object is the same as the obj argument
boolean b = nf.equals(nf1);
System.out.println("Object is the same: " + b);
}
} |
Output of the program:-
| Object is the same: false |
|