java.util.SimpleTimeZone.equals() Method



Description

The equals(Object obj) method is used to compare the equality of two SimpleTimeZone objects.

Declaration

Following is the declaration for java.util.SimpleTimeZone.equals() method.

public boolean equals(Object obj)

Parameters

obj − This is the SimpleTimeZone object to be compared with.

Return Value

The method call returns true if the given obj is the same as this SimpleTimeZone object; false otherwise.

Exception

NA

Example

The following example shows the usage of java.util.SimpleTimeZone.equals()

package com.tutorialspoint;

import java.util.*;

public class SimpleTimeZoneDemo {
   public static void main( String args[] ) {
      
      // create two simple time zone objects 
      SimpleTimeZone stobj1 = new SimpleTimeZone(720,"India");
      SimpleTimeZone stobj2 = new SimpleTimeZone(720,"India");

      // compare two objects      
      System.out.println("Comparison result: " + stobj1.equals(stobj2));
   }      
}

Let us compile and run the above program, this will produce the following result.

Comparison result: true
java_util_simpletimezone.htm
Advertisements