| Author |
examlab code(little modified q-30)
|
Arjun Srivastava
Ranch Hand
Joined: Jun 23, 2010
Posts: 431
|
|
above code compiles fine.
but if i remove both method 1 and 2,it gives error of ambiguity.
yes,i knew this when we are passing the varag argument of both same wrapper class and primitive type
it should be the error of ambiguity,but why with constructor only not with methods?
|
SCJP 6 | FB : Java Certifications-Help. | India Against Corruption
|
 |
Neha Daga
Ranch Hand
Joined: Oct 30, 2009
Posts: 504
|
|
|
did you try thid after removing the constructors??
|
SCJP 1.6 96%
|
 |
Arjun Srivastava
Ranch Hand
Joined: Jun 23, 2010
Posts: 431
|
|
Neha Daga wrote:did you try this after removing the constructors??
yea,after removing constructor,it works fine,no error.
it gives error only if we are calling the method or constructor with signature specified above.
Also gives same error of ambiguity.when we remove both method 1 and 2 means left only constructors.
|
 |
Neha Daga
Ranch Hand
Joined: Oct 30, 2009
Posts: 504
|
|
|
can you please tell me clearly whats your question?
|
 |
Trivikram Kamat
Ranch Hand
Joined: Sep 26, 2010
Posts: 155
|
|
Arjun Srivastava wrote:
but if i remove both method 1 and 2,it gives error of ambiguity
Even if both methods are commented, compiler gives error only when new instance of Class Main is created.
Otherwise, it compiles fine.
Arjun Srivastava wrote:
it gives error only if we are calling the method or constructor with signature specified above.
May be compiler comes across the ambiguity only when method or constructor is called.
|
OCPJP6
|
 |
Arjun Srivastava
Ranch Hand
Joined: Jun 23, 2010
Posts: 431
|
|
Neha Daga wrote:can you please tell me clearly whats your question?
sorry,i was wrong,Even if both methods are commented, compiler gives error only when new instance of Class Main is created.
Otherwise, it compiles fine.
i was trying to be oversmart.
Trivikram Kamat wrote:
Even if both methods are commented, compiler gives error only when new instance of Class Main is created.
Otherwise, it compiles fine.
May be compiler comes across the ambiguity only when method or constructor is called.
yes you are right compiler gives error only when new instance of Class Main is created,othervise it compiles fine.
i don't know what i was thinking when i asked this question.
thanks both of you for the reply.
|
 |
 |
|
|
subject: examlab code(little modified q-30)
|
|
|