The potential energy of an object in the context of gravity is determined by its height above a reference point. When a person throws a ball upward, its height increases until it reaches the highest point in its trajectory, which is known as the apex or peak of its path.
At this highest point, the ball's height is maximized, and therefore, the potential energy is also at its greatest. Once the ball reaches this peak, it will begin to fall back down, causing its height (and thus its potential energy) to decrease.
In summary, the ball will have the greatest potential energy at the highest point in its path.