title: how to call "Class" class as parameter in java
body: <p>for example I have following  method in class BugReportFactory:</p>
  
  <pre><code>public static void addFactoryImpl(Class impl) { }
  </code></pre>
  
  <p>I want to call this method from another class by following ways:</p>
  
  <pre><code>BugReportFactory.addFactoryImpl(new BugReportFactoryAndroid());
  </code></pre>
  
  <p>It says that following Argument is not applicable for Class class. </p>
  
  <p>Can anyone tell my mistake?</p>
  
  <p>ONE MORE QUESTION: </p>
  
  <pre><code>private static IBugReportFactory INSTANCE = null; 
  public static void addFactoryImpl(Class impl) { 
  INSTANCE = (IBugReportFactory)impl; 
  } 
  </code></pre>
  
  <p>But it shows errors specifying that you cannot cast class to object?</p>