hi,
I checked the link. Its really informative.
The question posted by eisa was not clarified though.
here is the question:
class
test {
public static void main(
String[] args) {
test inst_test = new test();
inst_test.method ( 1 , 1 , 1);
inst_test.method( new Integer(1) , new Integer(2) , new Integer(3) );
inst_test.method ( 1 , new Integer(5) );
inst_test.method ( new Integer(10) , 1 );
}
public void method( Integer... I ){
System.out.println("Eye in the sky");
}
public void method( float... i ){//LINE 1
System.out.println("Fly in the pie");
}}
her doubt was, even when applying the rules of advanced overloading this code is not compiling.
I thought of giving the explaination to this to check my understanding :
In LINE 1 we are using primitive types i.e float.
So it follows the normal overloading concept.I mean that int will be compatible to float and that is why the second method will be called.
But when we use Wrapper class Float, the compatibility is lost and hence the result:" THE CODE COMPILES FINE"
Please help me in my understanding. Am I correct in giving this explaination?
thanks!