>>5236154Because they grow from herbaceous plants.
Apples and cherries grow from plants that have a "secondary growth" = wood.
Vegetables don't have a secondary growth since they are herbaceous.
Melons belong to the same family as pumpkin, zucchini and cucumber (Cucurbitaceae) which are also all qualified as vegetables.
A cucumber as an example is also a berry and a fruit.
I guess it's kinda weird to grasp since it's all just a human made concept for us to distinguish certain plant features. In nature there are no berries, vegetables, grains and fruits if you know what I mean.
I'm basically just repeating what my textbooks say.
By our definition a watermelon is a vegetable.