| Author |
What is the meaning of "Primitive widening uses the smallest method argument possible"???
|
Gaurangkumar Khalasi
Ranch Hand
Joined: Jun 02, 2012
Posts: 186
|
|
Can anyone elaborate this sentence with some explanation???
|
 |
gurpeet singh
Ranch Hand
Joined: Apr 04, 2012
Posts: 868
|
|
consider following snippet of code
public void guru(long a , long b){}
public void guru(int a , int b) {}
Now consider following method call
byte a=9;
byte b = 8;
guru(a,b);
here we are calling guru method with 2 bytes. now which one will be invoked ? the answer lies in your question. the method with the smallest argument than the parameters are selected. in this case guru(int a, int b) will be selected.
|
OCPJP 6(100 %) OCEWCD 6(91 %)
|
 |
Gaurangkumar Khalasi
Ranch Hand
Joined: Jun 02, 2012
Posts: 186
|
|
Thank You..
|
 |
 |
|
|
subject: What is the meaning of "Primitive widening uses the smallest method argument possible"???
|
|
|