• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

examlab code(little modified q-30)

 
Ranch Hand
Posts: 432
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 504
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
did you try thid after removing the constructors??
 
Arjun Srivastava
Ranch Hand
Posts: 432
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can you please tell me clearly whats your question?
 
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic