Majority of trees are monecious, having flowers with both sexes. This is the "normal" state. One tree is all you need to get viable seed. Vast majority of plants follow this habit. In this group, there is a strategy for maintaining genetic diversity, for example some cherry trees, individuals will not accept their own pollen. In this case a second tree, genetically different (grown from a different seed) but of the same species is needed to pollinate the flower. Pecans, some cherries, some plums, pawpaws and a host of other tree species do this. In this case you need 2 of a kind, but any 2 will do.
Dioecious trees, each individual will have flowers that are male or female, but not both. The hollies are like this, also persimmon, kiwi, ginkgo, many members of the olive family, and a number of other species follow this pattern.
And then there are the various blends of patterns, with some trees changing sex based on environmental factors, such as light, there is an orchid (Catesetum) that in very bright light will have female flowers, and in shade will have male flowers, and sometime will have both when conditions are in-between.
Also there are exceptional clones, sports or mutations of trees that behave differently than the text book pattern for the species. For example the kaki persimmons used for culinary fruit (not the bonsai ones) the clones selected for kaki orchards are female trees, that if they are not pollinated, will still form fruit, and since they were not pollinated the resulting fruit will be seedless. Yet if a male persimmon were nearby, the fruit would have seed. The wild form of kaki persimmon will not form fruit if it is not pollinated.
So it is all over the map. It all depends on which species of tree you are looking at.