title: Passing in "any" class type into a java method
body: <p>Okay say I have a class:  </p>
  
  <pre><code>public class ExampleClass() {
      public void exampleClassMethod(ArrayList&lt;CustomClass&gt; abcdefg&gt; arrList) {
          ....
      }
      public void exampleClassMethod2(ArgumentToTakeInAnyCustomClass custClassArg) {
          ....
      }
  }
  </code></pre>
  
  <p>Now I want to be able to pass in any array list of any objects into that method in that class.  </p>
  
  <p>Let's say my custom classes to pass in would be CustomClass1, CustomClass2, CustomClass3.  </p>
  
  <p>How would I set up that method to accept any ArrayList that I pass in?  Also, lets say I just wanted to pass in one of those classes themselves, as in the second example method, how would I do that?  </p>
  
  <p>Thanks.  </p>
  
  <pre><code>public void testerMethodInitiater() {
      CustomClass1 abc = new CustomClass1();
      tester((Object) abc);
  }
  public static void tester(Object abc) {
      //do stuff
      System.out.println(abc);
      if(abc instanceof CustomClass1) {
          System.out.println("This is a CustomClass1");
      }
      (I need to tell the program to create a new CustomClass1 here if it's a CustomClass1) tester;// = new Object&lt;Universalvars.getClassInUse()&gt;;
  
  }  
  </code></pre>
  
  <p>Code above prints out that the object is an instance of CustomClass1, but I'm not sure how to make a new CustomClass1 at this time unless I did a conditional statement naming all possibilities that could take place which I'm trying to avoid.  </p>