The pineapple is technically not a single fruit, but a sorosis. The fruits of a hundred or more separate flowers grow on the plant spike.
As they grow, they swell with juice and pulp, expanding to become the "fruit." Pineapples do not grow on trees, as many erroneously think.
They are the fruit of a bromeliad, rising from the center on a single spike surrounded by sword-like leaves.
The pineapple plant is the only bromeliad to produce edible fruit.