SimpleTimeZone类的hashCode()方法为SimpleDateFormat对象生成哈希码。
用法:
public int hashCode()
参数:该函数不接受任何参数。
返回值:它返回该对象的哈希码。
异常:该函数不会引发任何异常。
下面的程序演示了上述函数:
示例1:
// program to demonstrate the
// function java.util.SimpleTimeZone.hashCode()
import java.util.*;
public class GFG {
public static void main(String[] args)
{
// create simple time zone object
SimpleTimeZone obj
= new SimpleTimeZone(500, "US");
System.out.println("SimpleTimeZone = "
+ obj);
// get hash code value and print
System.out.println("Hash code is = "
+ obj.hashCode());
}
}
输出:
SimpleTimeZone: java.util.SimpleTimeZone [ id=US, offset=500, dstSavings=3600000, useDaylight=false, startYear=0, startMode=0, startMonth=0, startDay=0, startDayOfWeek=0, startTime=0, startTimeMode=0, endMode=0, endMonth=0, endDay=0, endDayOfWeek=0, endTime=0, endTimeMode=0 ] Hash code is = 500
示例2:
// program to demonstrate the
// function java.util.SimpleTimeZone.hashCode()
import java.util.*;
public class GFG {
public static void main(String[] args)
{
// create simple time zone object
SimpleTimeZone obj
= new SimpleTimeZone(500, "IN");
System.out.println("SimpleTimeZone: "
+ obj);
// get hash code value and print
System.out.println("Hash code is = "
+ obj.hashCode());
}
}
输出:
SimpleTimeZone: java.util.SimpleTimeZone [ id=IN, offset=500, dstSavings=3600000, useDaylight=false, startYear=0, startMode=0, startMonth=0, startDay=0, startDayOfWeek=0, startTime=0, startTimeMode=0, endMode=0, endMonth=0, endDay=0, endDayOfWeek=0, endTime=0, endTimeMode=0 ] Hash code is = 500
相关用法
- Java SimpleTimeZone hasSameRules()用法及代码示例
- Java SimpleTimeZone clone()用法及代码示例
- Java SimpleTimeZone equals()用法及代码示例
- Java SimpleTimeZone getDSTSavings()用法及代码示例
- Java SimpleTimeZone getOffset()用法及代码示例
- Java SimpleTimeZone setDSTSavings()用法及代码示例
- Java SimpleTimeZone toString()用法及代码示例
- Java SimpleTimeZone inDaylightTime()用法及代码示例
- Java SimpleTimeZone setStartRule(int, int, int)用法及代码示例
- Java SimpleTimeZone setEndRule(int, int, int)用法及代码示例
- Java SimpleTimeZone setRawOffset()用法及代码示例
- Java SimpleTimeZone getRawOffset()用法及代码示例
- Java Set hashCode()用法及代码示例
- Java Map hashCode()用法及代码示例
- Java LocalTime hashCode()用法及代码示例
注:本文由纯净天空筛选整理自Twinkl Bajaj大神的英文原创作品 SimpleTimeZone hashCode() method in Java with Examples。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。