Let the speed of sailor in still water is x km/hr and the speed of stream is y km/hr.
Now, the speed of boat (upstream) = (x - y) km/hr
and the speed of boat (downstream) = (x + y) km/hr
Now, according to question,
8/(x + y) = 40/60 {Since time = distance/speed}
=> 8/(x + y) = 4/6
=> 4(x + y) = 8*6
=> 4(x + y) = 48
=> x + y = 48/4
=> x + y = 12 ................1
Again, 8/(x - y) = 1
x - y = 8 ...............2
Add equation 1 and 2, we get
2x = 20
=> x = 20/2
=> x = 10
From equation 1, we get
10 + y = 12
=> y = 12 - 10
=> y = 2
Hence, the speed of sailor in still water is 10 km/hr and the speed of stream is 2 km/hr