The question requires the lineup to be either BBBBGGGG or GGGGBBBB. I'm not sure if my thinking is correct, but this is my work so far:
Boys (notated as $B_1$ to $B_4$):
The first boy has 8 spots to stand in, therefore $P(B_1)$= $\frac 18$.
The second boy has 3 spots to stand in, therefore $P(B_2)$= $\frac 13$.
The third boy has 2 spots to stand in, therefore $P(B_3)$= $\frac 12$.
The fourth boy has only 1 spot to stand in, therefore $P(B_4)$= 1.
Girls (notated as $G_1$ to $G_4$):
The first girl only has 4 spots to stand in since the 4 boys occupied 4 spots already, therefore $P(G_1)$= $\frac 14$.
The second girl then has 3 spots to stand in, therefore $P(G_2)$= $\frac 13$.
The third girl has 2 spots to stand in, therefore $P(G_3)$= $\frac 12$.
The fourth girl has only 1 spot to stand in, therefore $P(G_4)$= 1.
Then $P(BBBBGGGG)$= ($\frac 18$ $\cdot$ $\frac 13$ $\cdot$$\frac 12$ $\cdot$ $1$ $\cdot$ $\frac 14$ $\cdot$ $\frac 13$ $\cdot$ $\frac 12$ $\cdot$ $1$) = $.000868$, which is the same for $P(GGGGBBBB)$, therefore the final answer is $0.001736$.
Is this correct or did I misunderstand anything?
There are $2$ cases: $B_1B_2B_3B_4G_1G_2G_3G_4$ or $G_1G_2G_3G_4B_1B_2B_3B_4$,and the probability for each is $\dfrac{4!\times 4!}{8!}$. Thus the probability boys together and girls together is: $\dfrac{2\times 4!\times4!}{8!}$