Monday 16 June 2014

hashCode() : Get the Hash Code of the String

public final int hashCode()
Computes a hashcode for this charset.

class StringHashCode{
 public static void main(String args[]){
  String s1 = new String("wxyz");
  
  System.out.println("s1 = " + s1);
  System.out.println("Hash Code of s1 is " + s1.hashCode());
 }
}

Output
s1 = wxyz
Hash Code of s1 is 3664322


Prevoius                                                 Next                                                 Home

No comments:

Post a Comment