I have an Abstract class, called A, and two inherited classes: B and C. I have a method with a parameter:
myMethod (final A a)
and I´d like to make different things in case of the type of the instanciated object. How can I do it?
An good alternative is following another design pattern, but I am not allowed to change my code now.
Thanks.
Use the
instanceofkeyword. For example: