title: passing different type of objects dynamically on same method
body: <p>I want to write a method which would receive different type of objects dynamically. Once I receive the dynamic object, I have logic inside method to do something based on the properties associated with that object. It would be something like below:</p>
  
  <pre><code>MainClass{
  class1 obj1;//all these are pojo
  class2 obj2;
  class3 obj3;
  method1(&lt;dynamic_object&gt;)
  }
      method1(&lt;dynamic_object&gt;){
          if(dynamic_object.property 1 == true){
              callmethod2(dynamic_object.property 1)
          }
          else{
              callmethod3(dynamic_object.property 1)
          }
      }
  </code></pre>
  
  <p>Here <strong>dynamic_objects</strong> are of different type.
  How can I achieve this in Java? <strong>I do not want to use reflection here</strong>.</p>