Please choose the correct answer to the question: A student wraps a wire around an iron nail. The student then connects the wire to a battery. The nail attracts another nail and they stick together. What force holds the two nails together?

Answer1: gravitational force Answer2: magnetic force Answer3: electric force Answer4: friction force

Answer format: answer1/answer2/answer3/answer4