Your weapon(s) is held in your hand during combat. If you are not in combat and standing, you can freely move your weapon(s) between your hand and on your back by pressing Z. When you are sitting, your weapon(s) will be on your back by default, and cannot be switched at that time.
I hope that answers your question properly! Have a great day! ^_^