Java中的MonthDay hashCode()方法
可以使用hashCode()Java中MonthDay类中的方法获取MonthDay的哈希码值。此方法不需要任何参数,它返回MonthDay的哈希码值。
演示此的程序如下
示例
import java.time.*;
public class Demo {
public static void main(String[] args) {
MonthDay md = MonthDay.parse("--02-21");
System.out.println("The MonthDay is: " + md);
System.out.println("The hash code is: " + md.hashCode());
}
}输出
The MonthDay is: --02-21 The hash code is: 149
现在让我们了解上面的程序。
首先显示MonthDay。然后,使用该hashCode()方法获得MonthDay的哈希码值并显示出来。演示此代码段如下所示:
MonthDay md = MonthDay.parse("--02-21");
System.out.println("The MonthDay is: " + md);
System.out.println("The hash code is: " + md.hashCode());热门推荐
1 如何训练狗狗不叫
2 训练狗狗不叫
3 训练狗狗随行
4 怎么训练狗狗不叫
7 训练比熊狗狗教程
10 上海狗狗训练
11 怎么训练狗狗上厕所
12 训练狗狗趴下
13 狗狗服从训练
14 训练狗狗拒食
15 训练狗狗笑
16 训练狗狗大便
17 训练狗狗立
18 训练狗狗捡东西