I have a question while studying HASHCODE.
If you look at the code above, I'm overriding hashCode()
It is possible to convert the string hash into an int-type and return it with the return hash.hashCode().
How can I recall hashCode() before overriding?
java
return hash.hashCode();
Are you curious about this part?
This code does not get the hashCode of super.
String hash = name + id + job;
return hash.hashCode();
You get the hashCode of the String-type instance that you created in the upper row. Overriding here is meaningless except to overwrite the method name.
When you ask questions, please write the code in text instead of screenshots. Don't forget to use code blocks.
Does hashCode() before overriding mean hashCode, a method of parent class? The method of the parent class is
super.method name (this)
You can invoke it as in . In this case, it would be super.hashCode(this)
.
547 Who developed the "avformat-59.dll" that comes with FFmpeg?
709 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
548 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
542 Unable to install versioned in Google Colab
537 Uncaught (inpromise) Error on Electron: An object could not be cloned
© 2024 OneMinuteCode. All rights reserved.