title: Java to sort list of custom object on the basis of string
body: <pre><code>class Person 
   {
   private String name;
   private String profession;
  }
  </code></pre>
  
  <p>profession has values: </p>
  
  <blockquote>
    <ul>
    <li>engineer</li>
    <li>Doctor</li>
    <li>Teacher</li>
    <li>student</li>
    </ul>
  </blockquote>
  
  <p>I have list of person and want to sort it on the basis of Profession.
  engineer comes first then Doctor and then Teacher and then student.</p>
  
  <p>Is it possible to sort it with comparable interface.</p>