Meaningless Drivel is fun!*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes float insted of double Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "float insted of double" Watch "float insted of double" New topic
Author

float insted of double

Ram Murthy
Ranch Hand

Joined: Aug 02, 2005
Posts: 91
class GFC216 {
static String m(float i) {return "float";}
static String m(double i) {return "double";}
public static void main (String[] args) {
char a1 = 1; long b1 = 2; System.out.print(m(a1)+","+ m(b1));
}}

The following code gives otuput as float, float.

Not sure why m(b1) call the overloaded method < static String m(float i) {return "float";}>

Is'nt long 64 bytes which is greater than 32 bytes for float. So ideally shouldn't the method which accepts double be called ??

Cheers,
JP


Cheers,
Ram
Sasikanth Malladi
Ranch Hand

Joined: Nov 04, 2000
Posts: 175
See this post: Method overloading
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: float insted of double
 
Similar Threads
simple or complicated?
What would be the result and why ?
choosing method
Method Overloading
narrowing the reference