aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes ambiguous reference Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "ambiguous reference" Watch "ambiguous reference" New topic
Author

ambiguous reference

Terrence White
Ranch Hand

Joined: Jun 26, 2002
Posts: 39
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

Joined: Aug 26, 2001
Posts: 7610
Here are some discussions that handle the same topic:
http://www.coderanch.com/t/239328/java-programmer-SCJP/certification/null-argument-method-being-passed
http://www.coderanch.com/t/239338/java-programmer-SCJP/certification/Why-null-not-common-object


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ambiguous reference