I just found out about a very interesting Java trick:
void method1(Integer... a){
}
So you can give this method as many integers as you want.
Now if I have a similar (overloaded) method like this:
void method1(int a, int b){
}
Which method runs when I execute the following line:
method1(1, 2);
Well, I could find that out very easily by just testing it out with different method instructions but when I think about the "rules" in "overloading" methods then I have to make sure that every overloaded method must be identical so that the compiler knows exactly which one to use.
In my opinion, the code above shouldn't work because the compiler should be confused. But when I try it out it works.
So.. does anyone know a bit more background information about this?