This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ambiguous reference

 
Terrence White
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I compile and run this code:

I get: BC
When I compile this code:

I get:
reference to m is ambiguous, both method m(A,B) in C and method m(C,A) in C match
m(null,null);
^
1 error
Why don't I get: CA ?
CA seems more specific than AB.

Also,
When I compile this code:

I get:
reference to m is ambiguous, both method m(A,C) in C and method m(B,B) in C match
m(null,null);
^
1 error
How do I figure how when the compiler will
chose one of the methods, and when I will get
the ambiguous reference error?
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic