aspose file tools*
The moose likes Beginning Java and the fly likes Unexpected Output? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Unexpected Output?" Watch "Unexpected Output?" New topic
Author

Unexpected Output?

Thapliyal Akshat
Greenhorn

Joined: Jun 04, 2009
Posts: 29
The below program prints CC. How? Why its not giving ambiguity error? How null gets type casted into C.




Sorry for not using the Code tag before posting this post. Post Updated as per your recommendations.

Thanks and Regards,
Akshat
Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
Please please please ... Code tags...


JDBCSupport - An easy to use, light-weight JDBC framework -
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13875
    
  10

When the Java compiler has to choose between a number of alternative methods that match a method call, it will choose the most specific one, if there is no ambiguity. In this case, the method that takes two Cs is the most specific one.

For the exact details see the Java Language Specification, paragraph 15.12.2.5: Choosing the Most Specific Method.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unexpected Output?
 
Similar Threads
Passing Null which mehod is called?
about overloading
overriding question
Overloading
Doubt regarding overloading