The hashCode() method is utilized to find the hash code of the stated string.
Method Definition: int hashCode()
Return Type: It returns an integer hash code of the string given.
Example #1:
// Scala program of int hashCode() // method // Creating object object GfG { // Main method def main(args:Array[String]) { // Applying hashCode method val result = "Nidhi".hashCode() // Displays output println(result) } } |
chevron_right
filter_none
Output:
75262122
Example #2:
// Scala program of int hashCode() // method // Creating object object GfG { // Main method def main(args:Array[String]) { // Applying hashCode method val result = " ".hashCode() // Displays output println(result) } } |
chevron_right
filter_none
Output:
32
Recommended Posts:
- Scala Int hashCode() method with example
- Scala String indexOf(String str) method with example
- Scala String startsWith(String prefix, int toffset) method with example
- Scala String lastIndexOf(String str, int fromIndex) method with example
- Scala String indexOf(String str, int fromIndex) method with example
- Scala String regionMatches(int toffset, String other, int offset, int len) method with example
- Scala String lastIndexOf(String str) method with example
- Scala String startsWith(String prefix) method with example
- Scala String split(String regex, int limit) method with example
- Scala String contentEquals() method with example
- Scala String substring(int beginIndex, int endIndex) method with example
- Scala String subSequence() method with example
- Scala String equalsIgnoreCase() method with example
- Scala String endsWith() method with example
- Scala String compareToIgnoreCase() method with example
- Scala String charAt() method with example
- Scala String equals() method with example
- Scala String compareTo() method with example
- Scala String getBytes() method with example
- Scala String indexOf() method with example
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

