MJ is unusual amongst plants, but not unique, in that the plants have two sexes. (Most plants are not like this, they have both male and female organs in the one flower.)
Also, unlike most plants, MJ is pollinated by wind, not insects, and does not then have a brightly coloured flower to attract insects.
The male flower is a sac of pollen, which bursts open to release the pollen to the wind. The female flower is what we call a bud, covered with thousands of pistils, fine hairs coated with trichomes containing sticky THC which catches pollen grains.
When the plant is 6 to 8 weeks old it develops pre-flowers, at the nodes of the plant, that is, where the branches meet the main stem. At this stage, which is long before actual flowering begins, we can identify the sex of the plant.
The male pre-flower is like a ball on a stick, often occurring in groups of two or three.
see top pic.
The female pre-flower can be recognised by the presence of pistils. see bottom pic
Both these are initially very small, and a magnifier is used to identify them. I have a watchmaker´s 9X eyeglass, but the standard lens from a 35mm SLR camera works very well.