Q:

compareTo method explain 1, -1, 0

Can anyone explain how the 1, -1, and 0 are used in compareTo and other methods in java?  I know how the methods work to a degree, but the three numbers confuse me. 

A:

By JavaDoc return from the method compareTo(obj) is:

a negative integer, zero, or a positive integer as this object is less
  than, equal to, or greater than the specified object. 

This mean that if you invoke method on current object this.compareTo(obj) and by your own logic in method compareTo this object grater than obj that you passed to method, return would be a positive integer. 
Your own logic mean that, for example in object that you compare to other, exist some integer field and if this field greater than other field in other object, by your logic, you consider that this object greater than other.