Java System类identityHashCode()方法及示例
系统类identityHashCode()方法 (System class identityHashCode() method)
identityHashCode() method is available in java.lang package.
identityHashCode()方法在java.lang包中可用。
identityHashCode() method is used to return the hashcode of the given object – By using this method the value of hashcode will be the same as the value of hashcode by using hashCode() method.
identityHashCode()方法用于返回给定对象的哈希码–通过使用此方法,哈希码的值将与使用hashCode()方法的哈希码的值相同。
Let suppose, if we pass an object that holds null value then in that case, the value of hashCode will be 0.
假设,如果我们传递一个持有null值的对象,则在这种情况下,hashCode的值将为0 。
identityHashCode() method is a static method so this method is accessible with the class name too.
identityHashCode()方法是静态方法,因此也可以使用类名访问此方法。
identityHashCode() method does not throw any exception.
identityHashCode()方法不会引发任何异常。
Syntax:
句法:
public static int identityHashCode(Object obj);
Parameter(s):
参数:
obj – represent the object for which the hashcode is to be returned.
obj –代表要为其返回哈希码的对象。
Return value:
返回值:
The return type of this method is int, it returns the hashcode of the given argument.
此方法的返回类型为int ,它返回给定参数的哈希码。
Example:
例:
// Java program to demonstrate the example of
// identityHashCode () method of System Class
import java.lang.*;
import java.io.*;
public class IdentityHashCodeMethod {public static void main(String[] args) throws Exception {File file1 = new File("Java");
File file2 = new File("Programming");
// getting hashcode
int hcode1 = System.identityHashCode(file1);
System.out.println(hcode1);
// getting hashcode
int hcode2 = System.identityHashCode(file2);
System.out.println(hcode2);
}
}
Output
输出量
E:\Programs>javac IdentityHashCodeMethod.java
E:\Programs>java IdentityHashCodeMethod
1018081122
242131142
翻译自: https://www.includehelp.com/java/system-class-identityhashcode-method-with-example.aspx
Java System类identityHashCode()方法及示例相关推荐
- java annotation class,Java Class类 isAnnotation()方法及示例
Class类isAnnotation()方法isAnnotation()方法在java.lang包中可用. isAnnotation()方法用于检查此Class对象是否表示注释类型. isAnnota ...
- getenv java_Java System类getenv()方法及示例
系统类getenv()方法getenv()方法在java.lang包中可用. getenv()方法用于返回键值对中当前环境变量的不可修改Map. 我们将看到什么是环境变量?环境变量是系统相关的外部命名 ...
- java字符类型的返回值,Java字符类isWhitespace()方法及示例
Character 类isWhitespace()法isWhitespace()方法在java.lang包中可用. isWhitespace()方法用于检查给定的char值是否为空格,但是它包含空格中 ...
- java system类_Java System类mapLibraryName()方法及示例
java system类 系统类mapLibraryName()方法 (System class mapLibraryName() method) mapLibraryName() method is ...
- java日历类add方法_Java日历computeTime()方法及示例
java日历类add方法 日历类computeTime()方法 (Calendar Class computeTime() method) computeTime() method is availa ...
- java日历类add方法_Java日历computeFields()方法及示例
java日历类add方法 日历类的computeFields()方法 (Calendar Class computeFields() method) computeFields() method is ...
- java日历类add方法_Java日历setFirstDayOfWeek()方法与示例
java日历类add方法 日历类setFirstDayOfWeek()方法 (Calendar Class setFirstDayOfWeek() method) setFirstDayOfWeek( ...
- java日历类add方法_Java日历setMinimalDaysInFirstWeek()方法与示例
java日历类add方法 日历类setMinimalDaysInFirstWeek()方法 (Calendar Class setMinimalDaysInFirstWeek() method) se ...
- java散列法的运用实例,Java HashMap compute() 使用方法及示例
Java HashMap compute() 使用方法及示例 Java HashMap compute()方法计算一个新值,并将其与哈希映射中的指定键相关联. compute()方法的语法为: has ...
最新文章
- jq执行2次同样的方法怎么让第一次执行的不触发_他们说,这段代码你能看得懂她的开始,却猜不中她的结尾。...
- 【项目管理】各种常用工具图表说明和示例
- Android Studio修改debug.keystore
- 基于Linux的USB 主/从设备之间通讯的三种方式
- c语言 sizeof_c语言详解sizeof
- openstack 安装windows系统
- Django错误解决: CSRF verification failed. Request abor
- mysql查询语句有点难_Mysql惯用函数,难点,注意_mysql
- centos7本地安装mysql数据库_在CentOS7系统上安装MySQL数据库
- 一图讲解一条sql语句的一生——《收获,不止Oracle》的读书笔记01
- 天涯明月刀手游服务器维护中,《天涯明月刀手游》12月17日服务器维护更新公告...
- NTL密码算法开源库-大整数ZZ类(三)
- 人生算法第一天心得总结(A)九段进阶(3-6)
- 简洁好用的3个研发项目管理工具
- 加油(c++程序猿)
- CVE-2014-0321漏洞成因分析
- MySQL查询满足条件的连续时间段
- 采购评标管理过程是怎样的?有哪些评标标准?
- 计算机手工操作管理方式是处于什么时代,2管理系统中计算机应用.ppt
- 倍福ads通讯软件_倍福TwinCAT ADS通讯-高级语言.ppt
热门文章
- linux+cp+-rdf,简单构建基于RDF和SPARQL的KBQA(知识图谱问答系统)
- HTML音乐播放没声音,网页没有声音但系统显示有声音怎么回事?如何解决?
- Linux基础(用户身份和文件权限)
- python axis 0 1_python pandas 中axis值0 1怎么分行还是列
- php 栈实现历史记录后退,栈:如何实现浏览器的前进和后退功能
- 高性能MySQL(3)——创建高性能索引
- 新手教程:不写JS,在MIP页中实现异步加载数据
- (转)深入理解最强桌面地图控件GMAP.NET --- 原理篇
- FusionCharts V3图表导出图片和PDF属性说明
- 利用Visio 2007图形化项目进度和项目跟踪