Can boys play softball?

They certainly can; it is not illegal. Be aware that, by nature, there will be a drastic size of female population paired against the minuscule percentage of males.

Having said that... once you are out of high-school, you may find more teams looking for a certain gender (or both, in some cases)-- it will depend on the severity and official'ity of the particular group.