转自:
Java Integer hashCode()方法具有什么功能呢?
下文笔者将讲述 java.lang.Integer hashCode()方法的功能简介说明,如下所示:
java.lang.Integer hashCode()的功能
java.lang.Integer.hashCode()的功能:
返回Integer对象的哈希值
java.lang.Integer.hashCode()的语法
语法
public int hashCode()
参数
无
返回值
返回Integer对象的哈希值
通常情况为Integer对象所对应的int值
例:
package com.java.other; import org.junit.Test; public class other { /** * java265.com Integer类的示例分享 * * @throws Exception */ @Test public void test() throws Exception { Integer i = 90; System.out.println(i.hashCode()); } } -------运行以上代码,将输出以下信息------ 90