We can't have 24 10-year-olds in a class of 20,
nor can we have 6 girls if 16 are boys.
Can you double-check the question ?
Presumably there are 30 students in the class.
Then, if you arrange the situation as sets,
with x being the number of 10-year-old boys
Hence, all the boys would be 10 years old