It takes the object referenced by sender, and attempts to cast it into the type Player. Java objects are strongly typed, which means you have to declare the type of the object.
If the object referenced by sender cannot be cast to a Player object, than an exception will be thrown for an InvalidCast.