Electrical Method
A steel bar or iron bar is placed inside a solenoid as shown below
When a direct current flow through the coil for few seconds, the bar will be found magnetized.
The polarity of the magnet depends on the direction of flow of current in the solenoid; if the current flows in an anticlockwise direction, the end of the specimen is the North Pole, but if the current flow is in a clockwise direction, it is South Pole.
Contact Method or Stroke Method
The contact method is divided into two: single touch and divided touch
Single touch/Stroke
The iron bar (specimen)is placed on a bench. The specimen is then stroked along its length using end of a bar magnet as shown. The magnet kept in an inclined position is dragged along the specimen from A to B, lifted well away and brought to A; the process is repeated several times.
At the end of the stroking it will be observed that the end A will have the same polarity as that of the stroking pole and end B will have an opposite polarity as that of the stroking pole.
Divided Touch/Stroke
The process is the same as single touch only that two bar magnet with opposite poles are used in stroking each half of the specimen and the stroking is done simultaneously outward from the centre of the bar. The process is repeated several times.
At the end of the process, the end will be found to have an opposite polarity to that of the striking pole.
Thank you