[code=java]
public class Main {
private double main= 54.42;
public Main() { }
public static void main(String[] args) {
Main main= new Main();
main.main();
main.main(42);
main("can");
}
private void main() { System.out.prin t("yes "); }
private void main(int i) { System.out.prin t("you "); }
private static void main(String s) { System.out.prin tln(s); }
}
[/code]
kind regards,
Jos
1.) Why would you want 2 main functions? Are you trying to implement multithreading or something?
2.) Would you even consider that a main function: private static void main(String s) { System.out.prin tln(s); } ? You are just overloading the main function, nothing more. The difference between a real main function and that overloaded imposter is: the program points and knows to point at the real main function. ... Am I making sense?
3.) That was really cute though.
To answer the poster's question. If you mean a method where the program starts, how can a program start at 2 different places? My answer would be no.
1.) Why would you want 2 main functions? Are you trying to implement multithreading or something?
Huh? overloaded methods have nothing to do with multiple thread.
Originally posted by kreagan
2.) Would you even consider that a main function: private static void main(String s) { System.out.prin tln(s); } ? You are just overloading the main function, nothing more. The difference between a real main function and that overloaded imposter is: the program points and knows to point at the real main function. ... Am I making sense?
Nope, but the OP wasn't making sense either ;-)
Originally posted by kreagan
3.) That was really cute though.
I know ;-)
Originally posted by kreagan
To answer the poster's question. If you mean a method where the program starts, how can a program start at 2 different places? My answer would be no.
Yup, and my terrible example just shows that. The question didn't make sense.
Of course different classes can all have a static void main(String[] args) method.
Huh? overloaded methods have nothing to do with multiple thread.
Sorry, I was refering to the first poster's question, not your crazy program. To me, it sounds like he wants to run 2 programs (threads) with 1 code.
Originally posted by JosAH
Yup, and my terrible example just shows that. The question didn't make sense.
Of course different classes can all have a static void main(String[] args) method.
Comment