You can't predict hashCode that will be called on your reference but you can find that always hashcode will be unique. By default toString() prints hashCode() which your class inherited from Object class.
First you should know when to use hash code. If you write following code you'll see two distinct hashcodes of Object's hashCode() implementation which you are inheriting.
public class Point {
private int xPos, yPos;
public Point(int x, int y) {
xPos = x;
yPos = y;
}
public static void main(String[] args) {
System.out.println(new Point(10,20));
System.out.println(new Point(10,20));
}
}
But It won't work if you want to insert your object into HashSet, HashMap collections. For this to work you must override hashCode() in your Point class. I couldn't write that code but overriding hashCode() depends on your own requirement which I don't know...
So finally what I meant to say is It's a best practice to implement hashCode(), toString(), equals() methods in our each and every custom classe.