Can anyone outline the use of the keyword "instanceof".
I mean, when do we use it etc..
Couple of examples would make it clearer i guess...
Read the section on instanceof. One good use of instanceof is in the equals() method that is inherited from the Object class. Since the method is defined as taking a type Object as a parameter, you need to check that it is of the correct type before casting it to that type - otherwise you would get an error. Read this article for info about how to implement the equals() method if you never have before. In their implementation of the equals method, you'll see that they use instanceof.