当前位置:网站首页>HashSet collection
HashSet collection
2022-06-11 18:18:00 【m0_ sixty million eighty-seven thousand seven hundred and twent】
package com.study.exception.demo21;
public class HashDemo {
/*
Hash value :
yes JDK Based on the address or string or number of the object int Type value
Object Class has a method to get the hash value of the object
public int hashCode(): Returns the hash code value of the object
The hash value of the object
1. The same object is called more than once hashCode() Method returns the same hash value
2. By default , Different objects have different hash values . And rewrite hashCode() Method , The hash value of different objects can be the same
*/
public static void main(String[] args) {
// Create student objects
Student s1 = new Student(" Zhang San ",10);
// The same object is called more than once hashCode() Method returns the same hash value
System.out.println(s1.hashCode());//460141958
System.out.println(s1.hashCode());//460141958
// By default , Of different objects hash It's not the same
// Override by method , The hash value of different objects can be the same
Student s2 = new Student(" Zhang San ",10);
System.out.println(s2.hashCode());//1163157884
System.out.println("hello".hashCode());//99162322
System.out.println("world".hashCode());//113318802
System.out.println("---------------");
System.out.println(" chinese ".hashCode());
System.out.println(" english ".hashCode());
}
}
边栏推荐
- Tle6288r is a 6-channel (150 MOhm) intelligent multi-channel switch using intelligent power technology - keshijin mall
- 密评-----
- SQL语句当查询条件为空时默认查询全部数据,不为空是则按照条件进行查询
- [C语言]用结构体把最高分的学生输出,可有多个最高分
- “LSTM之父”新作:一种新方法,迈向自我修正的神经网络
- There are three standards and three methods, i.e. fast growth and quick realization. How to choose the direction for making short videos of we media?
- Secret comment-----
- Global and Chinese markets of solid polymer aluminum capacitors 2022-2028: Research Report on technology, participants, trends, market size and share
- 判断是否为平衡二叉树
- 【C】 ATOI function implementation +offsetof implementation + exchange binary odd and even digits
猜你喜欢

Easycwmp source code analysis

264 Concepts
![Spring 2021 daily question [week5 not finished]](/img/bd/35a8e0ded3b1a0727415c4cd95e781.jpg)
Spring 2021 daily question [week5 not finished]

Use egg Js+mongodb simple implementation of curdapi

【C】 Compilation preprocessing and environment

SISO Decoder for Repetition(补充章节4)
![[c language] output the students with the highest scores with a structure. There can be multiple highest scores](/img/4e/836a8f717a2d9bf5f999a934ff4c91.png)
[c language] output the students with the highest scores with a structure. There can be multiple highest scores
![[collect first and use it sooner or later] 49 Flink high-frequency interview questions series (II)](/img/cf/44b3983dd5d5f7b92d90d918215908.png)
[collect first and use it sooner or later] 49 Flink high-frequency interview questions series (II)

jsfinder,wafw00f安装,nmap配置(缺少msvcr120.dll文件)

ACL 2022: is it no longer difficult to evaluate word polysemy? A new benchmark "dibimt"
随机推荐
软件测试技术复习
密评-----
264 Concepts
Système d'information sur les menaces à la sécurité des réseaux
[c language] output the students with the highest scores with a structure. There can be multiple highest scores
IEDA 底层菜单菜单简介
Codeworks round 481 (Div. 3) [done]
[not forgetting the original intention and forging ahead] 2021 Zhongchuang Suanli new year conference and anniversary celebration
Sorted circular linked list
如何学习和自学
Experiment 2: write a program and verify that the linear table sequence represents all operations
LeetCode_前缀树_中等_208. 实现 Trie (前缀树)
SISO decoder for a general (n,n-1) SPC code(補充章節3)
SISO decoder for min sum (supplementary Chapter 2)
[C语言]压缩字符串并添加标记字符
ISCSI详解(四)——ISCSI服务端配置实战
Some thoughts on how to do a good job of operation and maintenance management
Global and Chinese market of web content management software 2022-2028: Research Report on technology, participants, trends, market size and share
Can 400 fans earn 20W a month? How did you do it?
Use egg Js+mongodb simple implementation of curdapi