Hamming Distance: We can calculate how much Hamming Distance should be there so that we can correct any wrong bit

Hamming Code: By Hamming Code we can correct any wrong bit.

Questions:

1] Are they both different techniques or there is relation between Hamming Distance and Hamming Code?

or Hamming Distance is a generic concept(we can calculate Hamming Distance in any two numbers).

2] Why should anybody use Hamming Code where we can correct error by Hamming Distance?