<p>Many languages have a facility to check to see if an Object is of a certain type (including parent subclasses), implemented with 'is' and used like this:</p>

<pre><code>if(obj is MyType)
</code></pre>

<p>Or slightly more tediously you can in other languages check by using the 'as' keyword to do a soft typecast and seeing if the result null.   </p>

<p>I haven't used Java in years and I'm getting back up to speed on it but surely Java has a way to easily do this without delving deep into the Reflection APIs?</p>

<p>Thanks in advance for answers.  I have searched both here and other places but the keywords involved are so generic that even though I'm sure this has a simple answer, googling for it is hard.</p>

```
```
if (objectReference instanceof type){
    //Your code goes here
}
```
```
More info
here
.