Hello,
Can someone please tell me why this code compiles? I thought it must give an error because of an ambiguous call to varargs(), but it prints "Hello1" when varargs(1 ) is called.
package test; public class Test { public static void varargs(int x, int ...v) { System.out.println("Hello2"); } public static void varargs(int x) { System.out.println("Hello1"); } /** * * @param x * @param y */ public static void main(String[] args) { System.out.println("Main method"); varargs(1); } }