Let the speed of the boat in still water be \( x \) km/h, and the speed of the stream be \( y \) km/h.
- Speed downstream = \( x + y \) km/h
- Speed upstream = \( x - y \) km/h
Given:
- Distance downstream = 24 km, Time = 3 hours
- Distance upstream = 24 km, Time = 6 hours
Using the formula:
\[
\text{Speed} = \frac{\text{Distance}}{\text{Time}}
\]
Downstream speed = \( \frac{24}{3} = 8 \) km/h,
Upstream speed = \( \frac{24}{6} = 4 \) km/h.
Now, we have the equations:
- \( x + y = 8 \)
- \( x - y = 4 \)
Adding these two equations:
\[
(x + y) + (x - y) = 8 + 4
\]
\[
2x = 12 \quad \Rightarrow \quad x = 6
\]
Thus, the speed of the boat in still water is 6 km/h.
Answer: \(\boxed{6}\)