title: Java generic type arguments
body: <p>I have a method which takes a <code>List&lt;?&gt;</code> as an argument.</p>
  
  <pre><code>public static String method(List&lt;?&gt; arg){
       // Do something based on type of the list
  }
  
  //I call the method as below
  List&lt;ClassA&gt; listA = new ArrayList&lt;ClassA&gt;();
  List&lt;ClassB&gt; listB = new ArrayList&lt;ClassB&gt;();
  method(listA);
  method(listB);
  </code></pre>
  
  <p>In <code>method</code>, how do I know if <code>arg</code> is a <code>List</code> of <code>ClassA</code> or a <code>List</code> of <code>ClassB</code>?</p>