Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

examlab code(little modified q-30)

 
Arjun Srivastava
Ranch Hand
Posts: 432
Eclipse IDE Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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?
 
Neha Daga
Ranch Hand
Posts: 504
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
did you try thid after removing the constructors??
 
Arjun Srivastava
Ranch Hand
Posts: 432
Eclipse IDE Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 504
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you please tell me clearly whats your question?
 
Trivikram Kamat
Ranch Hand
Posts: 155
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Arjun Srivastava
Ranch Hand
Posts: 432
Eclipse IDE Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic