Java instanceof keyword : This is an example about java instanceof keyword usage. instanceof keyword is used for avoiding invalid casting classes objects at run time. In brief instanceof operator is used to check if a certain object belongs to a specific class or not. Usually this type of checking is used as a layer of validation at the beginning of general functions to clean the parameters sent to It.
Special case for instanceof keyword usage that If you have a part of your system generating a multiple types of objects , you will need to know the types of these objects before you start your logic on it . The big number of times to instanceof usage in your project is a sign of low quality of software design.