I’m not talking about confidence in how you look. I’m talking about the confidence you have when you are able to disagree with someone. Of course you can go around disagreeing with people and not have confidence. I’ll give a personal example to explain.
I have been studying the Bible and learning about Christ and what he taught for a while. I remember listening to others and their opinions on biblical things and being uncomfortable because I didn’t agree with them. I had a different view that I could back up. I started to be okay with disagreeing with them. Just because someone has been studying longer than I have doesn’t automatically make that person right about everything. (I do think humility is something to always keep in mind, though!)
This can apply to any field. You have been studying something for a while and are able to come up with theories or are able to summarize things well. You are getting more knowledge. Even if you are starting out learning something, it is okay to ask questions and play “devil’s advocate.” This is a sign of maturity and growth. This is confidence. It is not egotistical. It is free from false or forced modesty. It is okay to admit you know something! But it is also okay to admit you were wrong.