The ball when thrown upwards has two velocities.
1. vertical due to throwing upwards
2. horizontal due to the motion of the train.
If the velocity of the train is constant then the ball falls into the hand. Because the train and the ball have equal horizotal velocities.
If the train accelerates the ball will fall behind and if retards it will fall in front of the person.
Once the ball leaves the hand it is under gravity.
For the person who throws the ball it is in verticla motion.
But for a person on the platform the ball is in parabolic motion.