String Compareto vs jest równy Javie

compareTo() when you need to know the difference in length between strings 
that start with the same sequence of characters.
  
  System.out.println("sumit".compareTo("timus"));//-1
coder