Why when using instanceof in java to a null variable the output would be flase | SoloLearn: Learn to code for FREE!

0

Why when using instanceof in java to a null variable the output would be flase

12/3/2018 5:41:11 PM

Sheepriff

2 Answers

New Answer

+2

instanceof will return true if the value/value of a variable being tested is of the type being compared to keep in mind that you never test variable but actually value inside a variable consider the following: boolean a = "Coder" instanceof String;//returns true boolean b = null instanceof String;)//returns false

0

Thank you This helped alot