posted 16 years ago
Hi All,
Could you please clarify my doubts related to below question
If I compile this program , I am getting below compilation errors.
VarArgsTest.java:9: reference to doArgs is ambiguous, both method doArgs(int...) in VarArgsTest and method doArgs(java.lang.Integer...) in VarArgsTest match
vat.doArgs(1,2);
^
VarArgsTest.java:11: reference to doArgs is ambiguous, both method doArgs(int...) in VarArgsTest and method doArgs(java.lang.Integer...) in VarArgsTest match
vat.doArgs(new Integer(1),new Integer(2));
^
2 errors
If I do coment the any one of doArgs(int...) , doArgs(java.lang.Integer...) method , it is compiling and running fine. My doubt is that why is compiler treating doArgs(Integer i) and doArgs(int i) are different. In that case doArgs(int...) , doArgs(java.lang.Integer...) should be treated as different. Can you please explain.