I went to the object tab and parented with a bone. but when I did this, the object rotated and moved. what should I do to fix this? (weirdly when the object moves its place the location which is displayed on the tab that appears when you click 'n' is the same)
You must have parented the object with a bone that is not in Rest pose, so first select your bone in Pose mode and altG, altR, altS to reset its location, rotation and scale.
this is usual if you parent an object to another object in the relations parent field. (their xyz coordinates are placing the object in parents coordinatesystem.) usually you can use ctrl+P to parent objects without switching places. shift+P automatically rewrites the location, so that the object wont move. Just select the childmesh, then the armatures bone (in posemode), hit ctrl+P and select "Bone".