title: Passing Class type as a parameter
body: <p>I have two methods like this</p>
  
  <pre><code>public void updateA (Object obj) throws CommonException
  {
    if ( !(obj instanceof A) )
    {
       throw new CommonException(obj);
    }
    // other codes  
  }
  
  
  public void updateB (Object obj) throws CommonException
  {
    if ( !(obj instanceof B) )
    {
       throw new CommonException(obj);
    }
    // other codes  
  }
  </code></pre>
  
  <p>Now I want to extract the instance checking part into a separate method.
  Is it possible to do as follows?</p>
  
  <pre><code>public void chkInstance (Object obj, Class classType) throws CommonException
  {
    if ( !(obj instanceof classType) )
    {
       throw new CommonException(obj);
    }
  }
  </code></pre>