Lolmister Lolmister - 1 year ago 127
Java Question

The opposite of instanceof

Is it possible to get the opposite of instanceof in java? I have tried code like this:

if( example !instanceof blarg)....


but it won't let me put the ! anywhere without an error, please help.

Answer Source

You have to negate the entire thing:

if(!(example instanceof blarg))
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download