title: hashCode() method uses class to calculate the hashcode?
body: <p>During an interview, interviewer asked me - is the hashcode calculated based on Class?</p>
  
  <p>I told him, hashcode will be calculated based on the fields or variables in the class. He gave me some expression which makes me think like the answer is wrong.</p>
  
  <p>I read the java doc but I didn't get the clear idea. I read the post <a href="https://stackoverflow.com/questions/2427631/how-is-hashcode-calculated-in-java">how is hascode calculated in java</a> In that there is Integer hashcode and Character hashcode. Could anyone tell me how the hashcode for a particular object will be calculated and what is Interger hashcode and String hashcode? </p>