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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "What is the meaning of "Primitive widening uses the smallest method argument possible"???" Watch "What is the meaning of "Primitive widening uses the smallest method argument possible"???" New topic
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: 924
    
    1

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.
Gaurangkumar Khalasi
Ranch Hand

Joined: Jun 02, 2012
Posts: 186
Thank You..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What is the meaning of "Primitive widening uses the smallest method argument possible"???