java tutorial - Java Strings hashCode() method - java programming - learn java - java basics - java for beginners
Learn Java - Java tutorial - Java strings hashcode - Java examples - Java programs
Description
Java Strings hashCode() method - it returns a hash code for the given string. How the hash code is calculated for the object of String:
- The use of integer arithmetic, where s [i] is the i-th character of the string, n is the length of the string, and ^ indicates exponentiation. (The hash value of empty string is zero).
Syntax
Syntax of this method:
Options
Detailed information about the parameters:
- This is the default method, and it will not accept any parameters.
Return value
- In Java, hashCode () returns the hash value for this object.