Confusion about main method
I have been learning about Java for a few months now and every tutorial or text book tells me that when a program is compiled, that the JDK looks for a main method and starts from there. However, I thought I would test to see what would happen and so I created 2 classes, each containing a main method and then in the first class I created a method outside it's main method. Then in the main method of both classes I created an object from the first class and called the method that I created outside the main method of the first class. I then compiled the second method and it compiled successfully. However, this seems to be a contradiction to what I have been learning about.
Can anyone tell me what is going on?