I was thinking if there exists a better/nicer way to negate an instanceof in Java.
Actually, I\'m doing something like:
if(!(str instanceof String))
You can achieve by doing below way.. just add a condition by adding bracket if(!(condition with instanceOf)) with the whole condition by adding ! operator at the start just the way mentioned in below code snippets.
if(!(str instanceof String)) { /* do Something */ } // COMPILATION WORK
instead of
if(str !instanceof String) { /* do Something */ } // COMPILATION FAIL