Java classes and Member objects type
<p>I have a bit of confusion in the following:</p>

<pre><code>class Foo{
private ArrayList&lt;Obj1&gt; obj1List;
private ArrayList&lt;Obj2&gt; obj2List;


/* constructor */
...

public void push(?){

if(the object is of type Obj1)
    push into obj1List (object)
if(the object is of type Obj2)
    push into obj2List (object)

}
</code></pre>

<p>How can I do such a thing with the Push function, that it would identify the object type itself, without using instanceof (casting) or using (Object obj) as its' parameter? I need to it to know into which arraylist to push!</p>
