I haven't thought about instanceof that much, I use it in equality checks.
Here's a code that illustrates the uses of instanceof.
The output is
Hopefully this example illustrates the good and bad of instanceof.
As you pointed out, the instanceof doesn't compile when string / integer are mixed.
And, we can't write class A extends Integer to test A instanceof Integer because class Integer was declared final.
Also, you may want to look at pages on this site:
JavaExamples