A habit a routine of behavior that is repeated regularly and tends to occur subconsciously.
Thank you for your question. Masturbation is a very difficult habit to kick and it is only with a lot of effort, difficulty and time that a person will be able to fully rid themselves of it. As such do not despair in a number of ways failing. You just have to keep trying those ways and different ways and keep praying to succeed. There are many others in a similar position to you and yet others who have been successful. So it is possible to stop. The best solution is marriage, however, marriage may not be a solution entirely. It will primarily be an act of will power in the end, so don't leave it until marriage.
May you be successful and don't give up