Hello!
A ratio is a comparison of two values. This is comparing boys to total students. In each class, there are nine boys. With fifteen girls as well, this makes twenty four students.
This gives us the ratio 9:24
Note that both can be divided by three, so we get thus.
3:8 is the ratio of boys to total students.
I hope this helps!