```
class A {}

class B {}

public class Demo {

    public static void main(String[] args) {

        A a = new A();
        System.out.println(a instanceof B);
    }

}

```

This code is giving compile time error. 
How can I use `instanceof` to give false instead of compile time error when object is not an instance of class specified.