Get String hash code : String « Data Type « Java






Get String hash code

      
        
class MainClass {
  public static void main(String[] args) {
    String s1 = "abc";
    String s2 = "abc";
    String s3 = "def";

    System.out.println("s1 hash code = " + s1.hashCode());
    System.out.println("s2 hash code = " + s2.hashCode());
    System.out.println("s3 hash code = " + s3.hashCode());
  }
}

   
    
    
    
    
  








Related examples in the same category

1.To extract Ascii codes from a String
2.LengthOf - show length of things
3.Show string escapesShow string escapes
4.Convert string to char array
5.See if Strings are shared in Java
6.Find text between two strings
7.If a string is empty or not
8.Count word occurrences in a string
9.Check for an empty string
10.Remove leading and trailing space from String
11.Reverse a string
12.Put quotes around the given String if necessary.
13.Starts With Ignore Case
14.Repeat String
15.implements CharSequence