Male plants will produce flowers with many stamens, but no ovary, and therefore will not fruit. It is easy to tell the flower of the male, because they form in bunches at the end of a long flower stalk called a peduncle.
The hermaphrodite flower, like the female, forms in the axil, but you'll see both the pistil (female part) and stamen (male part). They can self-pollinate, and voila, you have some good eats.