| Author |
AutoBoxing
|
Balaji Bang
Ranch Hand
Joined: Apr 23, 2007
Posts: 180
|
|
//Fails To Compile
Why Autoboxing is not done here???
|
 |
Balu Sadhasivam
Ranch Hand
Joined: Jan 01, 2009
Posts: 874
|
|
|
Do you expect the method (Integer , Integer) to be called ?
|
 |
Rafael Angarita
Ranch Hand
Joined: Jan 09, 2009
Posts: 67
|
|
Compiler error: The method method(int i,Integer k) is ambiguous for the type Boxing()
The problem here is that more that one method match the invocation.
Anyway, I'm waiting for an explanation.
Does this kind of question appear in the real exam? (I'm confused here)
|
Rafael Angarita.
SCJP 6.
|
 |
Balu Sadhasivam
Ranch Hand
Joined: Jan 01, 2009
Posts: 874
|
|
//Fails To Compile
Why Autoboxing is not done here???
It fails because of AutoBoxing.Otherwise it would have thrown nosuch method error. as there is no method (Integer,int)
|
 |
Ruben Soto
Ranch Hand
Joined: Dec 16, 2008
Posts: 1032
|
posted

0
|
Rafael Angarita wrote:Compiler error: The method method(int i,Integer k) is ambiguous for the type Boxing()
The problem here is that more that one method match the invocation.
Anyway, I'm waiting for an explanation.
Does this kind of question appear in the real exam? (I'm confused here)
All three methods require boxing/unboxing, so if you have any 2 of those methods declared you will get a compiler error on the method invocation.
|
All code in my posts, unless a source is explicitly mentioned, is my own.
|
 |
 |
|
|
subject: AutoBoxing
|
|
|