title: How to know the class type without using instanceOf or getClass()?
body: <p>I have a class Person which is inherited by Student and Employee.
  I have another class PersonList, it has a list of type Person i.e List (elements can be of both Student and Employee type)</p>
  
  <p>There is a 3rd party API which has two overloaded methods i.e</p>
  
  <p><code>void display(Employee emp)</code> and <code>void display (Student student)</code></p>
  
  <p>When I iterate over Person list, I need to know the object type so that I can call to the appropriate display() method.</p>
  
  <p>I dont want to use instanceOf or getClass().</p>