Java Programming Chapter 4——Application of instenceof

Application of instenceof

1.Syntax: reference name instanceof class name

2 . Meaning: judge whether the actual object stored in the reference name is compatible with the following types, and the compatibility result is true, and the incompatibility result is false.

Example: