How can we avoid from masturbate?

Many do so regularly. Self-exploration is a part of human development and the discovery of self-pleasure often lead to repeating such acts at times, a very very common part of being alive and well. With satisfied relationship, this will reduce such drive/act, but intermittent self-pleasure should cause you no harm and should not have to stop. If excessive, then talk to your doc. Otherwise, enjoy being 22...Good luck.