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 ...
最新文章
- linux 下安装node 环境
- 作为一名Java程序员,这些Spring知识点面试官常考
- jsp中类似gridview的功能
- windows下安装composer方法
- VC++编译链接原理与过程
- Python爬虫进阶五之多线程的用法
- 周源:知乎的未来是什么
- android如何监听按钮,Android – 两个onClick监听器和一个按钮
- c#报错不实现接口成员_《C#程序设计》 习 题 集
- Python数据类型(元组、列表、字符串、字典)
- 转:WCF基础知识问与答
- SPSS多元线性回归及逐步回归学习笔记
- 联想微型计算机改win7,[系统帮助]lenovo联想WIN8改WIN7详细图文全教程
- 添加打印机怎样锁定计算机名称,怎么安装打印机?_百度经验
- C语言中字符型(char)的简单使用
- CSDN社区关于水晶报表的讨论
- 性价比一直是数据仓库中唯一重要的东西
- loadrunner测试论坛
- c int 转 char_C博客作业01--分支、顺序结构 - min小王
- 理解 Memory barrier(内存屏障)
热门文章
- 涉及子模块_COMSOL Multiphysics 5.6 RF模块更新详解
- linux远程拷贝免手动输入密码,scp远程拷贝避免输入密码
- mysql导入xml 工具下载_XML导入Mysql工具下载|XmlToMysql 最新版v2.1 下载_当游网
- html jq 控制显示密码,js、jquery分别实现点击密码输入框密码显示和隐藏
- iphone主屏幕动态壁纸_iPhone8怎么设置动态壁纸?iPhone8动态壁纸设置教程
- c语言斐波那契数列_剑指Offer-10-I.斐波那契数列
- 问题 B: 调整表中元素顺序(线性表)
- Public Sale【博弈】
- 深度学习框架PyTorch一书的学习-第四章-神经网络工具箱nn
- MySQL学习【第五篇SQL语句上】