aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Doubt in Integer and int Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Doubt in Integer and int" Watch "Doubt in Integer and int" New topic
Author

Doubt in Integer and int

asha ganapathy
Ranch Hand

Joined: Nov 03, 2006
Posts: 54
/* Code 1 */

In the above example i understood that here the compiler is confused to choose between both the overloaded methods, hence there is compiler error
/* Code 2 */

But in this example there are no compilation errors like the previous one.
i would like to know why?
Kaydell Leavitt
Ranch Hand

Joined: Nov 18, 2006
Posts: 688

I think that the way to understand the way that things are in Java 5.0 is to understand that in previous versions of Java there was no auto-boxing. So, for backward compatibility with Java version 1.4 (also known as 4.0) things in 5.0 have to be done the old way -- the way that they used to be done in 1.4 and earlier. This is necessary so that existing code works when upgrading to 5.0.

Kaydell
Abhishek Kanchan
Ranch Hand

Joined: May 10, 2007
Posts: 32
Hi,
I think there is an error in first method call where you are passing a reference to an int array where an Integer or int is expected.
To clear your doubts on autoboxing go through Zaikin's Tiger notes.


SCJP 1.5<br />SCWCD 5.0
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt in Integer and int
 
Similar Threads
re: ambiguous method calls
Ambiguity in calling Varargs
overloading
var...args
Method resolution