Home »
Java programming language
Java SimpleTimeZone hashCode() Method with Example
SimpleTimeZone Class hashCode() method: Here, we are going to learn about the hashCode() method of SimpleTimeZone Class with its syntax and example.
Submitted by Preeti Jain, on March 12, 2020
SimpleTimeZone Class hashCode() method
- hashCode() method is available in java.util package.
- hashCode() method is used to return the hash code value for this SimpleTimeZone.
- hashCode() method is a non-static method, it is accessible with the class object and if we try to access the method with the class name then we will get an error.
- hashCode() method does not throw an exception at the time of returning hash code.
Syntax:
public int hashCode();
Parameter(s):
- It does not accept any parameter.
Return value:
The return type of the method is int, it returns this SimpleTimeZone hash code value.
Example:
// Java program to demonstrate the example
// of int hashCode() method of
// SimpleTimeZone
import java.util.*;
public class HashCodeOfSimpleTimeZone {
public static void main(String args[]) {
// Instantiates SimpleTimeZone object
SimpleTimeZone s_tz = new SimpleTimeZone(360, "FRANCE");
// By using hashCode() method is to
// return the hash code of this
// simple time zone
int hash_code = s_tz.hashCode();
// Display HashCode
System.out.print("s_tz.hashCode(): ");
System.out.println(hash_code);
}
}
Output
s_tz.hashCode(): 360