One use for such a statement could be if you would have subclasses. Beware however that this is a bad example! (I'll explain why below).
If you need this kind of functionality,
you should really override the
makeSound method in the subclasses (make use of
polymorphism). The problem with the code above is that the
Animal class now contains functionality that really belongs in the subclasses. Besides, because the
Animal class needs to know about the existence of all of its subclasses, it's hard to add a new animal: you'd not only have to make a new subclass, but also modify the existing
Animal class.
This would be much better:
The use of
instanceof is often a code smell (a sign that something is wrong with the design of the program).