SimpleTimeZone equals(Object) in Java

equals(Object): This method is available in java.util.SimpleTimeZone class of Java.

Syntax:

boolean java.util.SimpleTimeZone.equals(Object obj)

This method takes one argument. This method compares the equality of two SimpleTimeZone objects.

Parameters: One parameter is required for this method.

obj: The SimpleTimeZone object to be compared with.

Returns: True if the given obj is the same as this SimpleTimeZone object; false otherwise.

Exceptions: NA

Approach

Java

import java.util.SimpleTimeZone;

public class SimpleTimeZoneequals {
    public static void main(String[] args) {

        SimpleTimeZone simpleTimeZone =
new SimpleTimeZone(100, "India");

        System.out.println(simpleTimeZone.equals(
simpleTimeZone));
    }
}

Output:

true


No comments:

Post a Comment