instanceof の null チェック

instanceof で null が渡された場合は false になることが言語仕様で保証されている。


if (obj instanceof String) {
// ここでは obj は null ではない。
}