title: instance Of Operator in java
body: <pre><code>class A {}
  
  class B {}
  
  public class Demo {
  
      public static void main(String[] args) {
  
          A a = new A();
          System.out.println(a instanceof B);
      }
  
  }
  </code></pre>
  
  <p>This code is giving compile time error. 
  How can I use <code>instanceof</code> to give false instead of compile time error when object is not an instance of class specified.</p>