Scala String hashCode() method with example Improve Improve Like Article Like Save Share Report 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) } } 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) } } Output: 32 Last Updated : 03 Oct, 2019 Like Article Save Article Previous Scala String replaceAll() method with example Next Scala String indexOf() method with example Share your thoughts in the comments Add Your Comment Please Login to comment...