In their flowers, male plants have stamens coated with pollen, while female plants have pistils that contain the ovaries. Most plants are both male and female, so gardeners are more likely to see both structures. Exceptions to this include holly and squash.
Pollination is usually done by animals and insects. In a bisexual flower, the female pistil is in the center of the blossom. The male stamens surround it. This makes it easier for bees to brush against the stamens on the way to the nectar in the base of the flower. Since the bees also brush up against the pistil, the flower may be pollinated with its own pollen.
In the holly plant, male and female flowers grow on separate bushes, indicating both male and female plants. Only female plants produce holly berries. Both male and female flowers grow on the squash plant, but the plant itself is bisexual. The male squash blossoms are taller, showier and start blooming earlier.
The advantage of perfect flowers, those with both female and male parts, is that these plants can be wind pollinated. Imperfect flowers that only have male or female parts are dependent upon animals and insects to get the job done. Even a squash plant, with both male and female flowers, needs help. The female flowers tend to grow around the center of the plant, while the males are restricted to the edges.