What is the main difference in an electromagnet and bar magnet?