java.lang.Enum类下hashCode()方法起什么作用呢?
下文笔者讲述java.lang.Enum类下hashCode()方法的功能简介说明,如下所示:
返回枚举对象的哈希值
hashCode()方法的功能
hashCode()方法的功能:返回枚举对象的哈希值
hashCode() 方法语法说明
语法 ppublic final int hashCode() 参数 无 返回值 返回hashCode信息
hashCode()方法的示例分享
package com.java.other;
import org.junit.Test;
enum t {
a {
},
b {
};
}
public class other {
/**
* java265.com Enum类的示例分享
*
* @throws Exception
*/
@Test
public void test() throws Exception {
System.out.println(t.a.hashCode());
}
}
---------运行以上代码,将输出以下信息-----
1032986144
版权声明
本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。


