File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply 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: 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..
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: What is the meaning of "Primitive widening uses the smallest method argument possible"???