Why are pineapples spiky?

Pineapples are spiky because the leaves are berry like fruit that we eat.

Pineapples are more than one particular fruit.