Java DateFormatSymbols equals() Example

DateFormatSymbols class equals() method example. This example shows you how to use equals() method.


Syntax is : public boolean equals(Object obj)
This method checks that specified object is equal to the this object or not.

Here is the code.
/**
 * @(#) EqualsDateFormatSymbols.java
 * A class representing use of method equals() of DateFormatSymbols
class in java.text Package.
 * @Version  16-May-2008
 @author   Rose India Team
 */
import java.text.*;
import java.util.*;

class EqualsDateFormatSymbols {

    public static void main(String[] args) {

        // Create new DateFormatSymbols object.
        DateFormatSymbols ObjDFormat1 = DateFormatSymbols.getInstance();

        // Create new DateFormatSymbols object.
        DateFormatSymbols ObjDFormat2 = DateFormatSymbols.getInstance
                (Locale.CHINESE);

        // equals method call.
        boolean bool = ObjDFormat1.equals(ObjDFormat2);
        System.out.println("ObjDFormat1 and ObjDFormat2 are equal....." + bool);
        bool = ObjDFormat1.equals(ObjDFormat1);
        System.out.println("ObjDFormat1 and ObjDFormat1 are equal....." + bool);
    }
}

Output of the program.
ObjDFormat1 and ObjDFormat2 are equal.....false
ObjDFormat1 and ObjDFormat1 are equal.....true

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US