The main problem was this:
+ signature of main(String... args) is different for - main(String[] args, String arg) - main(String arg, String[] args) + main(String... args) - not equals for main(String[] args, String[] args2) - only for main(String[] args)
although I will catch a compilation error in the following example:
public class MainOverloadingExample4 { void go(String s){ System.out.println("void go(String s)"); } void go(String ... s){ System.out.println("void go(String ... s)"); } void go(String s, String ... arr){ System.out.println("void go(String s, String ... arr){"); } public static void main(String[] args) { new MainOverloadingExample4().go("where I am?", "why I am here?"); } }
The go (String []) method is ambiguous for the type MainOverloadingExample
source share