In a dioecious species there are male plants, which only produce pollen, and female plants, which are the ones that bear fruit: kiwi, asparagus, pistachio, holly and bay. To get fruit you need at least one male near the females.
In a monoecious species, the same plant carries flowers of both sexes separately, as in courgettes, cucumbers, sweetcorn and hazel. The first courgette flowers are usually male and drop off without producing fruit: this is normal.

