File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes regarding long and float Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "regarding long and float" Watch "regarding long and float" New topic
Author

regarding long and float

saxena neera
Greenhorn

Joined: Apr 21, 2012
Posts: 10
i was developing the below code....




Both results in output float, float , what the reason behind that please advise and how can I call double please advise thanks a lot..!
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7487
    
  18

saxena neera wrote:Both results in output float, float , what the reason behind that please advise and how can I call double please advise thanks a lot..!

I suggest you look here.

Winston


Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
Vinod Vijay
Ranch Hand

Joined: Sep 13, 2011
Posts: 137

saxena neera wrote:i was developing the below code....





Both results in output float, float , what the reason behind that please advise and how can I call double please advise thanks a lot..!


Both are returning different string objects because you are returning string only. Method parameters have nothing to do here in this case. they are not doing any job. Period


Vinod Vijay Nair
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41041
    
  43
Vinod Vijay wrote:Method parameters have nothing to do here in this case. they are not doing any job.

I think you misunderstood the issue at hand. It is entirely about method parameters, and in particular, their type. It hinges on the fact that the parameter that fits most closely is chosen, and for a long, that is float, not double.

One way to achieve this would to call the method like this: m((double) b1)


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: regarding long and float
 
Similar Threads
float insted of double
What would be the result and why ?
Method conversion
choosing method
simple or complicated?