Imagine there are 8 spots on the shelf. Replace the volumes one by one.
The first volume to be replaced could go in any one of the eight spots.
The second volume to be replaced could then go in any one of the seven remaining spots.
The third volume to be replaced could then go in any one of the six remaining spots.
etc
So the total number of ways the eight volumes could be replaced
= 8!
= 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1
= 40,320