Let's call John's speed J.
Let's recall that speed is distance/time. Since the current was 1 km per hour, we can consider this as a subtraction when he was swiming against the current, and as an addition when he was swiming with it.
Since speed is distance/time, time is distance/speed.
This gives us, on one hand,
[tex]t=\frac{8}{J-1},[/tex]and on the other,
[tex]t=\frac{16}{J+1}\text{.}[/tex]The problem is telling us that these times are the same, so we get the following equation:
[tex]\frac{8}{J-1}=\frac{16}{J+1}\text{.}[/tex]To solve it, let's multiply both sides by (J-1)(J+1):
[tex](J+1)8=(J-1)16,[/tex][tex]8J+8=16J-16.[/tex]Let's subtract 8 from both sides:
[tex]8J=16J-24.[/tex]Now, let's subtract 16J from both sides:
[tex]-8J=-24.[/tex]Dividing both sides by -8:
[tex]J=3.[/tex]So Jhon would swim at a speed of 3 km/h if there were no current.