I am currently looking over some java code not written by me. In the java project there are mutiple packages, and I see three main methods, and they are all in different classes. Two of the classes containing the main method are in the same package, and the other main is in a seperate package. The main method alone in the seperate package seems to be called when I execute the code.
The first main method is
public static void main(String[] args) {
//code written in here seperate package
}
Second main method is
public static void main(String[] args) {
//code written in here same package as third main
}
Third main method is
public static void main(String[] argv) {
//code written in here same package as second main
}
All three method contain the same parameter, so it shouldn't be overloaded. They all have code that performs different functionality. How is this possible? How does java know which method to call? I am not getting any errors when executing this code through java jar command in the command line.