Confidence is a mental attitude that's learned with experiences. Once you undergo success, you'll tend to anticipate being successful. And that notion of anticipation will cause you to have a feeling of selfconfidence. For instance: A young fellow wishes to learn how to be a boxer, so he acquires lessons, and acquires a coach. His coach won't put him into the ring till he has accumulated adequate stamina and skill. And even then, the coach will only put him up against a rival that he recognizes his fighter may beat. When his fighter beats the adversary, he's successful, and begins to realize confidence in his abilities.
With every contest, the coach puts his fighter up against an adversary who's a slimly better fighter then the last, but not great enough to trounce his man. By the finish of the 3rd fight, the young boxer starts to expect to win his 4th, and so his self-confidence continues to develop. This scenario goes forward to repeat itself. And as long as the fighter succeeds, his expectations of success, and his feelings of confidence will go on to grow.